如何找到Lotus Fields DataType?

时间:2010-02-19 06:10:01

标签: c# com lotus-notes

我有以下代码来访问Lotus Form的字段(COM Interop),但我无法获取其dataType。(例如:Text,Number,DataTime)

        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();
             }
         }

3 个答案:

答案 0 :(得分:1)

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

答案 1 :(得分: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

}

答案 2 :(得分:0)

当字段是列表或多值项时,显然存在“秘密特征”,其将类型值加1。所以,如果你得到1281,那就告诉你它是一个文本列表。那是谣言!