| Michel 2004-06-04, 3:58 pm |
| Hi all,
Does anyone knows how to store a picture in the active directory using
ASP.NET?
I get an unspecified COM exception, and don't have a clue what the
problem is.
This is my code so far :
========================================
=======================================
private void UpdateADImage(string user, System.Byte[] image)
{
// Get the AD direcory Entry
DirectoryEntry AD = GetDirectoryEntry();
// Find the record in the Active Directory
DirectoryEntry RC = FindDirectoryEntry( AD, user);
// When a record found
if(RC != null)
{
// Next line does not work
//System.Drawing.Image _image =
System.Drawing.Image.FromStream(new System.IO.MemoryStream(image));
// Next line also does not work
//RC.Properties[fieldName].Value = image;
// Commit the changes
RC.CommitChanges();
}
else
{
throw new ApplicationException("Could not perform update!");
}
}
========================================
=======================================
Thanks!
|