2

I have a custom list with a script (JavaScript) allowing me to add some features/customisations to my list.

More precisely, I have a function in my script which creates an hyperlink according to a reference (in my columns' fields). I would like to call this function only if the logged user belong to a specific SharePoint Group.

I'm using SharePoint 2007 (MOSS) and JavaScript (without jQuery neither Designer).

Edit: It's a little more tricky because I have to check if the user belongs to a specific SharePoint Group, but within several sites. The SharePoint Group is a little different throw each sites, for example :

siteA Managers (in site A)

siteB Managers (in site B)

So, I would like to only check if the current user belongs to "Managers", it will match for all the sites. Is it possible de make a comparison like *Managers or something like that, I'm not very handy with JS.

1 Answer 1

2

You can find the Groups for an User using the Web Service GetGroupCollectionFromUser.

SPServices can help you; but it's using jQuery. Same thing with SharepointPlus.

You'll have to send a SOAP envelope (XML) to the Web Service. The body of your AJAX request will look like that:

    var body = "<soap:Envelope xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'>"
    + "<soap:Body><GetGroupCollectionFromUser xmlns='http://schemas.microsoft.com/sharepoint/soap/directory/'>"
    + "<userLoginName>"+username+"</userLoginName>"
    + "</GetGroupCollectionFromUser></soap:Body></soap:Envelope>"
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.