コード例 #1
0
ファイル: DecryptLockboxes.cs プロジェクト: hross/wci-hacks
        /// <summary>
        /// List properties in the portal
        /// </summary>
        /// <param name="session">Session to use for propety listing.</param>
        /// <returns></returns>
        public static SortedList ListProperties(IPTSession session)
        {
            SortedList list = new SortedList();

                //get all the properties for this user
                IPTProfileManager pm = (IPTProfileManager) session.OpenGlobalObject(PT_GLOBALOBJECTS.PT_GLOBAL_PROFILE_MANAGER, false);
                bool bRequestEdit = true;
                IPTObjectProperties profileEOD = pm.GetUserProperties(session.GetSessionInfo().GetCurrentUserID(), bRequestEdit);

                //put all the properties in a hashtable, indexed by object id
                XPHashtable profileData = new XPHashtable();

                XPArrayList valList;
                int propertyIndex;

                // First get non-reference property data
                IASQueryResult profileQR = GetObjectPropData(profileEOD);

                propertyIndex = 0;

                while (propertyIndex < profileQR.GetCount()) {
                    // get value type
                    valList = GetAllValues(profileQR, propertyIndex);
                    profileData.RemoveElement(profileQR.GetFields(propertyIndex, PT_PROPIDS.PT_PROPID_OBJECTID));
                    profileData.PutElement(profileQR.GetFields(propertyIndex, PT_PROPIDS.PT_PROPID_OBJECTID), valList);

                    list.Add(profileQR.GetFields(propertyIndex, PT_PROPIDS.PT_PROPID_OBJECTID), profileQR.GetFields(propertyIndex, PT_PROPIDS.PT_PROPID_PROP_VALUETYPE));

                    if (valList.GetSize() == 0) {
                        break;
                    }

                    propertyIndex += valList.GetSize();
                }

                IASQueryResult profileRefQR = GetObjectPropRefData(profileEOD);
                propertyIndex = 0;

                while (propertyIndex < profileRefQR.GetCount()) {
                    // get value type
                    valList = GetAllValues(profileRefQR, propertyIndex);
                    profileData.RemoveElement(profileRefQR.GetFields(propertyIndex, PT_PROPIDS.PT_PROPID_OBJECTID));
                    profileData.PutElement(profileRefQR.GetFields(propertyIndex, PT_PROPIDS.PT_PROPID_OBJECTID), valList);

                    list.Add(profileRefQR.GetFields(propertyIndex, PT_PROPIDS.PT_PROPID_OBJECTID), profileRefQR.GetFields(propertyIndex, PT_PROPIDS.PT_PROPID_PROP_VALUETYPE));

                    if (valList.GetSize() == 0) {
                        break;
                    }

                    propertyIndex += valList.GetSize();
                }
            // profile data
            return list;
        }