示例#1
0
        /// <summary>
        /// This function loops through the portal and finds all properties which are lock boxes
        /// (either user names or passwords). It prints out their IDs -- it could probably used with the above to
        /// grab actual info from the properties.
        /// </summary>
        /// <param name="session">The user session to use for finding the properties.</param>
        public static void GetLockBoxProperites(IPTSession session)
        {
            IPTObjectManager profilePageObjMgr = session.GetProfilePages();
            IPTObjectManager profileSectionObjMgr = session.GetProfileSections();

            PTObjectManagerQueryWrapper omqw = new PTObjectManagerQueryWrapper(profilePageObjMgr);
            Object[][] queryFilter = PlumtreeHelpers.GetQueryFilter(PT_PROPIDS.PT_PROPID_OBJECTID, PT_FILTEROPS.PT_FILTEROP_EQ, PT_INTRINSICS.PT_PROFILE_PAGE_CREDENTIAL_VAULT);
            omqw.Query(PT_PROPIDS.PT_PROPID_OBJECTID, -1, null, queryFilter);

            if (omqw.GetCount() > 0) {
                IPTProfilePage page = (IPTProfilePage) profilePageObjMgr.Open(1, false);

                object[] lockboxes = page.GetChildSections();

                for (int i = 0; i < lockboxes.Length; i++) {

                    int lockBoxId = (int) lockboxes[i];
                    IPTProfileSection profileSection = (IPTProfileSection) profileSectionObjMgr.Open(lockBoxId, false);
                    Object[] arPropIDs = profileSection.GetChildProperties();
                    if (arPropIDs.Length >= 2) {
                        Console.WriteLine(XPConvert.ToInteger(arPropIDs[0]));
                        Console.WriteLine(XPConvert.ToInteger(arPropIDs[1]));
                    }
                }
            }
        }