473,383 Members | 1,815 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,383 software developers and data experts.

Storing Photos in Active Directory - jpegPhoto attribute - User class

Has anyone tried this in VB .NET or via VBScript? Can it be done? How
do we handle retrieving a binary data format (the photo) using ADSI or
VB .NET? All my searching on the net yielded no useful results except
for a half completed Perl script which claimed to be able to upload and
download photos stored in AD as part of the User account.
Nov 20 '05 #1
5 24366
It is pretty easy to do in .NET. Not as easy in VBScript.

Essentially, you just read the data you want into a byte array (from a
filestream or something). Then, bind to the object with the DirectoryEntry
class and call the Add method on the PropertyValueCollection for that
attribute with the byte array. Then call CommitChanges. Download would be
basically just the opposite.

I believe Matjaz Ladava posted a sample showing how to do this in .NET in
one of the MS newsgroups that you could find with a Google search pretty
easily.

Joe K.
"netcoder77" <ne***************@yahoo.com> wrote in message
news:Oq**************@TK2MSFTNGP12.phx.gbl...
Has anyone tried this in VB .NET or via VBScript? Can it be done? How
do we handle retrieving a binary data format (the photo) using ADSI or
VB .NET? All my searching on the net yielded no useful results except
for a half completed Perl script which claimed to be able to upload and
download photos stored in AD as part of the User account.

Nov 20 '05 #2
Joe Kaplan (MVP - ADSI) wrote:
It is pretty easy to do in .NET. Not as easy in VBScript.

Essentially, you just read the data you want into a byte array (from a
filestream or something). Then, bind to the object with the DirectoryEntry
class and call the Add method on the PropertyValueCollection for that
attribute with the byte array. Then call CommitChanges. Download would be
basically just the opposite. Sounds straightforwards enough, don't know why I thought it was more
complicated than it sounds. I'll have to try it out.
I believe Matjaz Ladava posted a sample showing how to do this in .NET in
one of the MS newsgroups that you could find with a Google search pretty
easily. Thanks for that information. I'll now search for the author's name.
Thanks for your suggestions.

On a different note, does anyone know if there would be any problems
with storing large number of jpeg images in the user object as part of
AD? How is replication affected? And caveats?

Joe K.
"netcoder77" <ne***************@yahoo.com> wrote in message
news:Oq**************@TK2MSFTNGP12.phx.gbl...
Has anyone tried this in VB .NET or via VBScript? Can it be done? How
do we handle retrieving a binary data format (the photo) using ADSI or
VB .NET? All my searching on the net yielded no useful results except
for a half completed Perl script which claimed to be able to upload and
download photos stored in AD as part of the User account.


Nov 20 '05 #3
On the activedir.org mailing list, there was a discussion about this a few
months ago. Depending on the size of the objects, this may or may not be a
problem with replication. That tends to be very sensitive to your actual
deployment and how often they change (probably not very often I assume).
You might want to add them to the directory slowly if you are worried and
try to keep the sizes down.

However, one thing to consider is that by default, users have rights to
modify this property directly with their own account AND the attribute has
no max size. As such, it could be used maliciously by some users as a DoS
attack on your DC if they decided to upload their swap file or something
similarly large. You might want to think carefully about allowing users
rights to modify this attribute directly.

Joe K.

"Net Coder" <ne***************@yahoo.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Joe Kaplan (MVP - ADSI) wrote:
It is pretty easy to do in .NET. Not as easy in VBScript.

Essentially, you just read the data you want into a byte array (from a
filestream or something). Then, bind to the object with the DirectoryEntry class and call the Add method on the PropertyValueCollection for that
attribute with the byte array. Then call CommitChanges. Download would be basically just the opposite.

Sounds straightforwards enough, don't know why I thought it was more
complicated than it sounds. I'll have to try it out.
I believe Matjaz Ladava posted a sample showing how to do this in .NET in one of the MS newsgroups that you could find with a Google search pretty
easily.

Thanks for that information. I'll now search for the author's name.
Thanks for your suggestions.

On a different note, does anyone know if there would be any problems
with storing large number of jpeg images in the user object as part of
AD? How is replication affected? And caveats?

Joe K.
"netcoder77" <ne***************@yahoo.com> wrote in message
news:Oq**************@TK2MSFTNGP12.phx.gbl...
Has anyone tried this in VB .NET or via VBScript? Can it be done? How
do we handle retrieving a binary data format (the photo) using ADSI or
VB .NET? All my searching on the net yielded no useful results except
for a half completed Perl script which claimed to be able to upload and
download photos stored in AD as part of the User account.


Nov 20 '05 #4
Joe Kaplan (MVP - ADSI) wrote:
On the activedir.org mailing list, there was a discussion about this a few
months ago. Depending on the size of the objects, this may or may not be a
problem with replication. That tends to be very sensitive to your actual
deployment and how often they change (probably not very often I assume).
You might want to add them to the directory slowly if you are worried and
try to keep the sizes down.
However, one thing to consider is that by default, users have rights to
modify this property directly with their own account AND the attribute has
no max size. As such, it could be used maliciously by some users as a DoS
attack on your DC if they decided to upload their swap file or something
similarly large. You might want to think carefully about allowing users
rights to modify this attribute directly.


Hmm. The object does not have maximum or minimum size set but the ACL
on a W2K3 AD server in native mode doesn't seem to allow SELF write to
the jpegPhoto attribute/property, or am I missing something?
Nov 20 '05 #5
Sorry, I misled you a little bit. The attribute I was thinking of is the
thumbnailPhoto attribute which is a Win2K attribute with the same syntax and
size limitations. It is in the Personal-Information control access right,
so users do generally have rights to write to it. jpegPhoto is new for 2K3
and is not in the Personal-Information CAR. I'm still not that used to 2K3
schema.

So, the warning still applies to thumbnailPhoto in terms of security/DoS,
but not to jpegPhoto.

Joe K.

"Net Coder" <ne***************@yahoo.com> wrote in message
news:Ox**************@TK2MSFTNGP09.phx.gbl...
Joe Kaplan (MVP - ADSI) wrote:
On the activedir.org mailing list, there was a discussion about this a few months ago. Depending on the size of the objects, this may or may not be a problem with replication. That tends to be very sensitive to your actual deployment and how often they change (probably not very often I assume).
You might want to add them to the directory slowly if you are worried and try to keep the sizes down.
However, one thing to consider is that by default, users have rights to
modify this property directly with their own account AND the attribute has no max size. As such, it could be used maliciously by some users as a DoS attack on your DC if they decided to upload their swap file or something
similarly large. You might want to think carefully about allowing users
rights to modify this attribute directly.


Hmm. The object does not have maximum or minimum size set but the ACL
on a W2K3 AD server in native mode doesn't seem to allow SELF write to
the jpegPhoto attribute/property, or am I missing something?

Nov 20 '05 #6

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

Similar topics

0
by: microsoft | last post by:
Hi People, when I try to modify an active directory user programatically, I receive the following exception: The server is unwilling to process the request Reading the microsoft web site, I...
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...
10
by: huzz | last post by:
I have web application that quaries the Active Directory to get user details.. everything works fine but someday I'll get System.Runtime.InteropServices.COMExection and if I restart the client...
2
by: Ross | last post by:
Hi I have an application using asp.net that I am running on my PC. The web form has a text box where you can enter a name for a new Photo category then click on the button. The code is...
1
by: tangus via DotNetMonster.com | last post by:
Hello all, I'm really struggling with getting some Active Directory code to work in ASP.NET. Can you please provide assistance? I am executing the following code: Dim enTry As DirectoryEntry =...
0
by: S Lemen | last post by:
Hi, How are Active Directory user object attributes removed in VB .Net? The remove method succeeds but the CommitChanges errors with: "The attribute syntax specified to the directory service...
8
by: Mr. Bean | last post by:
Hello, I'm trying to retrieve the user's properties from Active Directory. I was able to retrieve all the user properties, however, I wassnt able to get the manager's user name. What I got was...
18
by: Arthur | last post by:
Hi All, I would like to get the name of the user given their networkID, is this something Active Directory would be useful for?(For intranet users) If so, can you please point me to some sample...
0
by: hshah | last post by:
Hello All, I am developing an intranet application. We are going to use AD for that. I want to find out "logon" name and based on that I want to capture "department" attribute from a...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.