igalbk 0 Newbie Poster

Hi
I'm using C# to work with AD (Win 2012R2).
We are syncing AD users,groups and their relationship to SQL database.
Full sync works well.
But when using synchronization cookie, the relationship changes does not detected.
What may be the reason?
Thanks.
Here is my code:

    public void DirSyncChanges(DirectoryEntry de, byte[] cookie)  
    {
        DirectorySynchronization syncData = new DirectorySynchronization(cookie);
        srch = new DirectorySearcher(de)
        {
            Filter = "(&(objectClass=user)(objectCategory=person))",
            SizeLimit = Int32.MaxValue,
            Tombstone = true
        };
        srch.DirectorySynchronization = syncData;
        syncData.Option = DirectorySynchronizationOptions.None;
        using(SearchResultCollection results = srch.FindAll())

        foreach (SearchResult res in results)
        {
            //results is empty. no loop
        }
    }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.