473,408 Members | 2,839 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

Thumbnailphoto property in Active Directory

Hi,

I am trying to store a thumbnail picture in ActiveDirectory, but am having
some problems with type conversions.

According to the documentation the Thumbnailphoto property in the directory
is of typ OctetString, and i belive i read somewhere that i can use the
convert.ToBase64string function to convert a byte array to a octetstring.
This seem to be working since i can insert a image with the code:

Dim myEntry As New DirectoryEntry("LDAP://" & MyPath)
Dim myStream As New IO.FileStream("c:\myImage.jpg, IO.FileMode.Open)
Dim myByte() As Byte
ReDim myByte(CInt(myStream.Length))
myStream.Read(myByte, LBound(myByte), UBound(myByte) - 1)
MsgBox(myStream.Length)
myEntry.Properties("ThumbNailPhoto").Value =
Convert.ToBase64String(myByte)
myEntry.CommitChanges()

I am not sure that the data i am inputting here is valid, but i can see that
the property in the directory is being populated.

My real issue occurs when i try to retrieve the image back from the
directory, how do i convert the data back to a byte array ?

I have tried

Dim myEntry As New DirectoryEntry("LDAP://" & MyPath)

Dim myArr() As Byte
myArr = CType(myEntry.Properties("ThumbNailPhoto").Value, Byte())
Dim myStream As New IO.MemoryStream(myArr)
Dim myImage As Drawing.Image
PictureBox1.Image = MyImage.FromStream(myStream)

Which doesn not work, and when i check the .length property of the byte
array, it does not have the same size as it had when i input the data.
I have a feeling i need to convert the data from the directory before
puttimg it into the byte array, but i am a bit lost here.

If someone have some ideas on how to do this, I would appreciate it.

Many thanks

Niclas

Nov 20 '05 #1
0 4408

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Mario Rodriguez | last post by:
Hi people. I have a problem adding users to Win2003 active directory programatically. When I execute my app throws the following exception: .................The specified directory service...
0
by: Jason | last post by:
I am trying to get the lockoutTime property for a user object in Active Directory. Does anyone know what type it is or could give me some c# code Thank Jason
6
by: Leo_Surf | last post by:
Hello, I need your help adding user in Active Directory from ASP.net website. Could any one provide me the complete code for the html page. As this is my curriculam project and I dont have any...
10
by: Hriday | last post by:
Hi there, Please help me..It is urgent This is Hriday, working on windows authentication with Active Directory... My requirment is when a user sends a request to my web Applicatoin I want to...
0
by: RTT | last post by:
here is my current situation. I develop a program on my computer's localhost. From there i contact Active directory succesfull using a connectionstring like:...
0
by: =?Utf-8?B?SmVhbmluZQ==?= | last post by:
Hi, can anyone tell me how I can update the publicDelegates active directory property using vb.net 2005 and System.DirectoryServices. I understand the publicDelegates property to be where 'send of...
0
by: fabiomoggi | last post by:
Hello Guys, I am developing a web application to manage Active Directory resources, and one of my tasks is to map Organizational Units hierarchy into a SQL Server database. Let's suppose that I...
0
by: lairpr74 | last post by:
Hi, I got a console application that updates active directory users, the information to be updated in active directory comes from a database table. This is my problem: right now the application...
0
by: =?Utf-8?B?RGFt?= | last post by:
Hi, I'm developing an ASP .NET application that writes in user object properties of Active Directory. I specifed writting rights for users or groups in the domain by using the AD console. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.