This project is read-only.

cannot clear fields

Mar 9, 2009 at 9:52 PM
It appears to work when I clear a field, but when I reload the page I notice that the field was never cleared in AD. For example, if a user no longer has a pager or mobile number, and the they attempt to blank the field, it appears to be successfull but the field remains filled in AD.

Any ideas?
May 5, 2009 at 7:39 PM
Hi,

I resolved the problem with this (at least the old version didn't have the logic to clear the field in AD, so I added some code to do that):

if (ADMobilePhone && txtMobile.Text.Trim() == "") objAD.DeleteProperty(accountName, clsAD.ADProperties.mobile, txtMobile.Text.Trim());

public void DeleteProperty(string accountName, ADProperties property, string propertyValue) {
DirectoryEntry wc = FindOne(ADProperties.samAccountName, accountName).GetDirectoryEntry();
wc.Properties["" + property + ""].Clear(); wc.CommitChanges();
}

Hope this helps you.

-Henri
Jun 29, 2009 at 3:02 PM

Thank you Henri.

Yes - the code to clear the fields is painfully absent in the current release.

Dec 29, 2009 at 7:00 AM

Hi Guys

Sorry where do I modify the source to add in the DeleteProperty? I tried it out for awhile but it doesn't seems to be working plus the source code that I downloaded does not seems to have any coding on Mobile.