Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Creating a new user remotely on SharePoint

0 views
Skip to first unread message

Jsimpson

unread,
Oct 1, 2008, 1:42:43 PM10/1/08
to
So, I have a great script that sets up a new domain user and all the
setting associated with them being a new user, but the one thing I
still have to do manually is add them to SharePoint in their
departments group. It's not really a big deal, but I would like to be
able to do it with my script. To this end I have done some research,
but I am not really grocking something about using the UsersGroups web
service from SharePoint. Maybe you all can help. :)

Ok, so I started with the great script from "I love SharePoint" Get-
WebServiceProxy.ps1 found at http://cglessner.blogspot.com/2008/07/powershell-webservices-sharepoint.html
and the URL of the web service I want to user from
http://sharepoint.microsoft.com/blogs/zach/Lists/Posts/Post.aspx?ID=9

. .\Get-WebServiceProxy.ps1
$proxy = Get-WebServiceProxy "http://<server-url>/_vti_bin/
usergroup.asmx"
$proxy.UseDefaultCredentials = $true

I know this is working because I can get the user list with

$proxy.GetUserCollectionFromWeb().Users.User

I am not sure where to go from here though. I found the reference to
UserGroup web service on MSDN
http://msdn.microsoft.com/en-us/library/ms772575.aspx
but all the examples are in VB and C#. C# looks like it should be
close, but I am not making the mental leap. Hopefully somebody can
send me on the right path...

Thanks,
JSimpson

Oisin (x0n) Grehan [MVP]

unread,
Oct 1, 2008, 4:56:02 PM10/1/08
to
On Oct 1, 1:42 pm, Jsimpson <jsimpson2...@hotmail.com> wrote:
> So, I have a great script that sets up a new domain user and all the
> setting associated with them being a new user, but the one thing I
> still have to do manually is add them to SharePoint in their
> departments group.  It's not really a big deal, but I would like to be
> able to do it with my script.  To this end I have done some research,
> but I am not really grocking something about using the UsersGroups web
> service from SharePoint.  Maybe you all can help.  :)
>
> Ok, so I started with the great script from "I love SharePoint" Get-
> WebServiceProxy.ps1 found athttp://cglessner.blogspot.com/2008/07/powershell-webservices-sharepoi...
> and the URL of the web service I want to user fromhttp://sharepoint.microsoft.com/blogs/zach/Lists/Posts/Post.aspx?ID=9

>
> . .\Get-WebServiceProxy.ps1
> $proxy = Get-WebServiceProxy "http://<server-url>/_vti_bin/
> usergroup.asmx"
> $proxy.UseDefaultCredentials = $true
>
> I know this is working because I can get the user list with
>
> $proxy.GetUserCollectionFromWeb().Users.User
>
> I am not sure where to go from here though.  I found the reference to
> UserGroup web service on MSDNhttp://msdn.microsoft.com/en-us/library/ms772575.aspx

> but all the examples are in VB and C#.  C# looks like it should be
> close, but I am not making the mental leap.  Hopefully somebody can
> send me on the right path...
>
> Thanks,
> JSimpson

Just an aside, if you want to connect to a sharepoint web service
WITHOUT having to download the 200MB+ .NET sdk, you can use my *pure*
powershell script solution at:

http://www.nivot.org/2007/08/07/NewImprovedGetWebServiceProxyGeneratorForPowerShell.aspx

Once you've got the webservice proxy, it's as easy calling;

ps> $proxy.AddUserToGroup($groupName, $userName, $userLoginName,
$userEmail, $userNotes)

Which is documented (in vb,net/c#) at:

http://msdn.microsoft.com/en-us/library/ms772647.aspx

Hope this helps,

- Oisin

- Oisin

Jsimpson

unread,
Oct 2, 2008, 10:56:07 AM10/2/08
to
Wow, that is great! Thank you so much. I knew I was close.... :)

JSimpson


On Oct 1, 4:56 pm, "Oisin (x0n) Grehan [MVP]" <ois...@gmail.com>
wrote:

> http://www.nivot.org/2007/08/07/NewImprovedGetWebServiceProxyGenerato...


>
> Once you've got the webservice proxy, it's as easy calling;
>
> ps> $proxy.AddUserToGroup($groupName, $userName, $userLoginName,
> $userEmail, $userNotes)
>
> Which is documented (in vb,net/c#) at:
>
> http://msdn.microsoft.com/en-us/library/ms772647.aspx
>
> Hope this helps,
>
> - Oisin
>

> - Oisin- Hide quoted text -
>
> - Show quoted text -

0 new messages