Current user member of...??

  • Thread starter .-=] ExTrEmE [=-.
  • Start date
E

.-=] ExTrEmE [=-.

Another question! :)

There's a way to know the group or groups the current user is member of,
directly from infopath (2007) ?
I've looked on Usergroup.asmx webservice and the specifice call to
GetGroupCollectionFromUser... but i can't get it working :-(

I've serched on the net.. but nothing of helpful :(
I create a new connection to get data, from webservice, UserGroup.asmx,
select GetGroupCollectionFromUser.. then infopath force me to write a sample
user login (and i see only this in the list).
I put in my login, it found me. Connection created... but looking in data
source i see only userLogin property.. nothing else :(

So..
How can i pass to the service the login of current user, each time forms
open?
How can i view the group of current user?

Any help form me?
Thanks Again
 
G

Gavin McKay

Hello,

By "current user" I'm assuming you mean Sharepoint user and groups... lmk if
that's not what you want...

I used this for a Forms-based authenticated site, so Windows-based may be
different. Write some code-behind in the Infopath form similar to the
following:

SPWeb site = new SPSite(<url for site>).OpenWeb();
myLoginName = site.CurrentUser.LoginName;
myName = site.CurrentUser.Name;

foreach (SPGroup g in site.CurrentUser.Groups)
{
// Do something with each of the groups this user belongs to
groupName = g.Name;
}

Note that if you are testing your form locally rather than on the web, this
will return an error from memory, so I used a simple check to see what the
template path was

eg. string myWebUrl = this.Template.Uri.ToString();

and then check if the myWebUrl is a url, or a filepath.

HTH

Gavin.
 
E

.-=] ExTrEmE [=-.

By "current user" I'm assuming you mean Sharepoint user and groups... lmk
if
that's not what you want...

Exactly what I want :)
Sharepoint user and groups :)
I used this for a Forms-based authenticated site, so Windows-based may be
different. Write some code-behind in the Infopath form similar to the
following:

[CUT]


Thanks, this is a good solution.
There's a 'problem'.. Actually I can't build forms with code, because i'm
not the admin.. and asking to admins to approve forms can take long time
:( (it's big banking group).
So.. there's a way to get the same results with use of standard moss2007
webservices?

Thanks again
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top