2010-02-19 64 views
1

我有下面的代码来访问Lotus Form的字段(COM互操作),但我无法得到它的数据类型。(如:文本,数字,DATATIME)如何查找Lotus Fields数据类型?

 NotesSession notesSessionClass = new NotesSession(); 
     notesSessionClass.Initialize(pPassword); 
     NotesDatabase pNotesDatabase= notesSessionClass.GetDatabase("", pDatabaseName, false); 
     object objectForms = pNotesDatabase.Forms; 
     Array formArray = (System.Array)objectForms; 

     for (int cnt = 0; cnt < formArray.Length; cnt++) 
     { 
      NotesForm localForm = (NotesForm)formArray.GetValue(cnt); 

      Array fieldsArray = (System.Array)localForm.Fields; 
      for (int fieldCnt = 0; fieldCnt < fieldsArray.Length; fieldCnt++) 
      { 
       string field = (string)fieldsArray.GetValue(fieldCnt); 
       FIELD_TYPE fieldType = localForm.GetFieldType(field); 
       string strFieldType = fieldType.ToString(); 
      } 
     } 
+0

你会得到什么错误或意外的值? – 2010-02-19 09:09:28

回答

1
public enum MyLotusFieldType 
{ 
    //http://publib.boulder.ibm.com/infocenter/domhelp/v8r0/index.jsp?topic=/com.ibm.designer.domino.main.doc/H_TYPE_PROPERTY_ITEM.html 

    // Legal values 
    ACTIONCD = 16,// means saved action CD records; non-Computable; canonical form. 
    ASSISTANTINFO = 17,// means saved assistant information; non-Computable; canonical form. 
    ATTACHMENT = 1084,// means file attachment. 
    AUTHORS = 1076,// means authors. 
    COLLATION = 2,//. 


    // Note This value is new with Release 6 
    DATETIMES = 1024, //means date-time value or range of date-time values. 
    EMBEDDEDOBJECT = 1090, //means embedded object. 
    ERRORITEM = 256, //means an error occurred while accessing the type. 
    FORMULA = 1536, //means Notes formula. 
    HTML = 21, //means HTML source text. 
    ICON = 6, //means icon. 
    LSOBJECT = 20, //means saved LotusScript Object code for an agent. 
    MIME_PART = 25, //means MIME support. 
    NAMES = 1074, //means names. 
    NOTELINKS = 7, //means link to a database, view, or document. 
    NOTEREFS = 4, //means reference to the parent document. 
    NUMBERS = 768, //means number or number list. 
    OTHEROBJECT = 1085, //means other object. 
    QUERYCD = 15, //means saved query CD records; non-Computable; canonical form. 
    READERS = 1075, //means readers. 
    RFC822Text = 1282, //means RFC822 Internet mail text. 
    RICHTEXT = 1, //means rich text. 
    SIGNATURE = 8, //means signature. 
    TEXT = 1280, //means text or text list. 
    UNAVAILABLE = 512, //means the item type isn't available. 
    UNKNOWN = 0, //means the item type isn't known. 
    USERDATA = 14, //means user data. 
    USERID = 1792, //means user ID name. 
    VIEWMAPDATA = 18, //means saved ViewMap dataset; non-Computable; canonical form. 
    VIEWMAPLAYOUT = 19 //means saved ViewMap layout; non-Computable; canonical form 

} 
1

GetFieldType返回一个整数。可能的值在NotesItem.Type的文档中进行了解释。

0

显然有一个“秘密功能”,当字段是一个列表或多值项目时,将类型值加1。所以如果你得到1281,它会告诉你这是一个文本列表。这是传闻!