SenseNet.DirectoryServices.SyncAD2Portal.GetSyncInfo C# (CSharp) Метод

GetSyncInfo() публичный Метод

Gets portal info for given LDAP path. If resulting SyncInfo object's SyncTreeFound is false, no other properties are filled.
public GetSyncInfo ( string ldapPath ) : SyncInfo
ldapPath string The LDAP path of the object, ie. CN=MyGroup,OU=MyOrg,DC=Nativ,DC=local
Результат SyncInfo
        public SyncInfo GetSyncInfo(string ldapPath)
        {
            SyncInfo result = new SyncInfo();

            SyncTree syncTree = null;
            foreach (SyncTree sTree in _syncTrees)
            {
                if (sTree.ContainsADPath(ldapPath))
                {
                    syncTree = sTree;
                }
            }

            if (syncTree == null)
                return result;
            
            result.SyncTreeFound = true;
            result.SyncTreeADPath = syncTree.ADPath;
            result.SyncTreePortalPath = syncTree.PortalPath;
            result.SyncTreeADIPAddress = syncTree.IPAddress;
            result.TargetPortalPath = syncTree.GetPortalPath(ldapPath);
            result.PortalNodeExists = string.IsNullOrEmpty(result.TargetPortalPath) ? false : Node.Exists(result.TargetPortalPath);
            var parentPath = syncTree.GetPortalParentPath(ldapPath);
            result.PortalParentExists = string.IsNullOrEmpty(parentPath) ? false : Node.Exists(parentPath);

            return result;
        }

Usage Example

Пример #1
0
 /* ==================================================================================== Event handlers */
 protected void _btnCheck_Click(object sender, EventArgs e)
 {
     var syncAD2Portal = new SyncAD2Portal();
     var syncInfo = syncAD2Portal.GetSyncInfo(_tbLdapPath.Text);
     
     string syncInfoStr;
     if (!syncInfo.SyncTreeFound) {
         syncInfoStr = "Configured SyncTree could not be found for this path. Check the <a href='/Explore.html#/Root/System/SystemPlugins/Tools/DirectoryServices/AD2PortalConfig.xml' target='_blank'>configuration</a>!";
     }
     else 
     {
         syncInfoStr = string.Format("Configured synctree: ({0}, {1}) -> ({2}) (<a href='/Explore.html#/Root/System/SystemPlugins/Tools/DirectoryServices/AD2PortalConfig.xml' target='_blank'>configuration</a>)<br/>Target portal path: <a href='/Explore.html#{3}' target='_blank'>{3}</a><br/>{4}<br/>{5}",
             syncInfo.SyncTreeADIPAddress,
             syncInfo.SyncTreeADPath,
             syncInfo.SyncTreePortalPath,
             syncInfo.TargetPortalPath,
             syncInfo.PortalNodeExists ? "Target path exists" : "Target path does not exist",
             syncInfo.PortalParentExists ? "Target parent path exists" : "Target parent path does not exist"
             );
     }
     this.Controls.Add(new Literal { Text = "<hr/><strong>Results:</strong><br/>" });
     this.Controls.Add(new Literal { Text = syncInfoStr });
 }
All Usage Examples Of SenseNet.DirectoryServices.SyncAD2Portal::GetSyncInfo