Solved

C# setting extensionAttribute1 not working!?

Posted on 2010-09-13
3
856 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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

APEX (Application Express) is used to develop a web application from Oracle. SQL Workshop is one of the tools that comes with Oracle APEX to query or modify the database objects or to make any changes to the structure.
Creating and Managing Databases with phpMyAdmin in cPanel.
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…

708 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now