Solved

C# setting extensionAttribute1 not working!?

Posted on 2010-09-13
3
863 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Header Font Size in Grid View 6 27
c#, case, if 4 20
Options for Linking SQL tables to Access 2013 9 42
C# LINQ 5 26
Creating and Managing Databases with phpMyAdmin in cPanel.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
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…

733 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