For Programmers: Free Programming Magazines  


Home > Archive > C# > June 2004 > Picture in Active Directory









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Picture in Active Directory
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!
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com