Solved

C# setting extensionAttribute1 not working!?

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
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…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…

707 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