Logo 
Search:

Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

Programmatically add users to sharepoint

  Asked By: Judith    Date: Dec 08    Category: Sharepoint    Views: 2982

does anyone know how to do this? I am told you can do it with ADSI but I am
skeptical...

Share: 

 

8 Answers Found

 
Answer #1    Answered By: Chandrabhan Baroova     Answered On: Dec 08

ADSI works very well for this kind of thing. We've set up SPPS in extranet
mode, and created a web part that makes calls to a dll created in VB to manage
users from a webpart itself.

We require that all SPPS users  are members of a particular group on the DC. The
dll has methods that return a list of all users in that group, details of a
particular user, allows portal coordinators to add, remove, and change details
of users (including logon name and password), and allows individual users to
change their own information. It does require Win2K, since the dll makes calls
to the AD via LDAP.

So, while my learning curve with ADSI has been steep, the dll has been working
with no problems (other than programmer-induced bugs) so far. We're in the
final stages of development for this web part now.

To be sure, there are some security issues since LDAP requires that a user with
sufficient privileges be used to make changes to the AD. Since this user's
password and logon are part of the calls to ADSI, some care has be to taken to
hide them in case the dll is viewed in a hex editor. However, this is a fairly
easy thing to do, and I think that we've achieved a reasonable level of
security.

Unfortunately, I can't pass along any code at the moment, but I'm talking to my
legal people about that.

 
Answer #2    Answered By: Stacey Wilder     Answered On: Dec 08

Could your dll be run from a web site to add  users, without going into
sharepoint?

 
Answer #3    Answered By: Francis Vargas     Answered On: Dec 08

Probably. I mean, then methods are avialalbe via ASP, so that shouldn't be a
problem. One thing you might want to do is check out O'Reilly's excellent book:

Developing ASP Components, 2nd Edition
(http://www.oreilly.com/catalog/devaspcom2/)

Not only is it an excellent reference for creating ASP components, but one of
it's chapters is devoted to using ADSI for managing users. I relied on it quite
heavily during initial development.

 
Answer #4    Answered By: Tori Oconnor     Answered On: Dec 08

We've managed to use the knowledge folder object to retrieve lists of
users - all this is quite easy, but we can find no property of the object
that allows you to actually add  users from the domain directly into
sharepoint as a coordinator, author etc. can you possibly name the cdo
object and property?

 
Answer #5    Answered By: Kristan Benjamin     Answered On: Dec 08

Or am i missing the point about ADSI? I have used it to create NT accounts,
but how do you access the workspace settings element in the management
folder via adsi?
again, an object to play around with would be great - i can find the
properties easily enough I'm sure.

The other thing is, have you figured out how to move transparently from web
to sharepoint  without incurring another login box. We have sps on a
different ip to the web site and no matter what we try, we keep getting an
nt login box. we have tried using adsi to authenticate the user prior to
calling sharepoint.

 
Answer #6    Answered By: Vivian Mcguire     Answered On: Dec 08

I see what you're getting at. Generally I add  users to subfolders of
the Documents folder, so I'm probably skirting your issue all together?


Have you tried setting your local logon privelages? As I recall, our networking
guys had to set this to get rid of secondary logons on our extranet machine.
Also, I think I mentioned it before, but it's worth mentioning again: we're
running everything on Win2k.

 
Answer #7    Answered By: Augustine Snider     Answered On: Dec 08

i am trying to add  users to NT but now keep getting general access denied
error...can anyone help?

 
Answer #8    Answered By: Genevieve Sherman     Answered On: Dec 08

I think what you are looking for is the IKnowledgeFolder's Readers, Authors,
Approvers, and Coordinators properties. These properties return a variant
array of NT accounts that have permissions for these roles.

Say for example, you want to add  user "MyDomain\SomeUser" to the "Readers"
role of a particular folder:

Dim MyKnowledgeFolder As PKMCDO.KnowledgeFolder
Dim vReaderArray As Variant
Dim vThisUser as Variant
Dim TheNewUser as String

Set MyKnowledgeFolder = New PKMCDO.KnowledgeFolder

'Connect to your Knowledge folder here.
.
.
.


'Set the new user's domain and user name.
TheNewUser = "MyDomain\SomeUser"

'Get the array of readers.
vReaderArray = MyKnowledgeFolder.Readers

'Check if the user is already a member of "Readers"
For Each vThisUser In vReaderArray
If vThisUser = TheNewUser Then Exit Sub
Next vThisUser

'Add the new user to the array.
ReDim vReaderArray UBound(vReaderArray) + 1
vReaderArray UBound(vReaderArray) = TheNewUser

'Replace the Readers with the new array.
MyKnowledgeFolder.Readers = vReaderArray
.
.
.


This code is untested. But It should send you in the right direction.

 
Didn't find what you were looking for? Find more on Programmatically add users to sharepoint Or get search suggestion and latest updates.




Tagged: