Solved

C# setting extensionAttribute1 not working!?

Posted on 2010-09-13
3
862 Views
Last Modified: 2013-12-24
Hey all!

I am creating accounts in AD which works perfectly. As soon as I try to add the extensionAttribute1 in the LDAP is fails:

if (!String.IsNullOrEmpty(extensionAttribute1))
                {                    
                    newUser.Properties["extensionAttribute1"].Add(extensionAttribute1);
                }

Any ideas?
0
Comment
Question by:KazooSoft
3 Comments
 
LVL 10

Expert Comment

by:james-ct16
ID: 33661760
Good evening

Couple of quick questions that may help you get an answer,

What is the error message you are getting?

What happens if you do a check first to see if extensionattribute1 exists eg newuser.Properties.contains ?

Regards

James
0
 
LVL 4

Author Comment

by:KazooSoft
ID: 33661833
There is no error being produced which is baffling me!

I have manually checked the LDAP and the field will not exist like many other fields I am setting but they all work :S

Cheers,
0
 
LVL 3

Accepted Solution

by:
aledev earned 500 total points
ID: 33663587
Hi
try this code and let me know
if (!String.IsNullOrEmpty(extensionAttribute1))
    if (user.Properties.Contains("extensionAttribute1"))
    {
        //update the attribute
        newUser.Properties["extensionAttribute1"].Value = extensionAttribute1;
    }
    else
    {
        //add it
        newUser.Properties["extensionAttribute1"].Add(extensionAttribute1);
    }
    newUser.CommitChanges();
}

Open in new window

0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Mysql Left Join Case 10 70
jquery + C#.net radiobuttonlist 3 30
Adding items to a C# list incrementally 5 33
Comparison query - 4 columns 9 25
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
When it comes to protecting Oracle Database servers and systems, there are a ton of myths out there. Here are the most common.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question