Check if a user belongs to specific SharePoint Group- using SharePoint Designer 2013/2010 Workflow
Hi there,
I am working on a SharePoint list and i would like users to be assigned permissions to items based on their groups.
I did look at using workflows but i couldnt find anything useful :(
Any tips or advice would be appreciated.
Cheers
Now that SP2013 workflows allow you to run web services, you could use REST/SOAP web service that, as I recall, allows you to enumerate a group for members:
http://yoursite/yourmanagedpath/yoursitecollection/yoursite/_vti_bin/usergroup.asmx
Do some reading on the GetUserCollectionFromGroup method and see if that doesn't get you what you are looking for...
Similar Messages
-
Check user belongs to a particular sharepoint group in sharepoint 2013 designer workflow
Hello, How to validate a user belongs to a particular sharepoint group in sharepoint designer 2013 workflow.
You can make a REST call from workflow to determine if a user belongs to a group.
REST API reference and samples
Calling the SharePoint 2013 Rest
API from a SharePoint Designer Workflow
This post is my own opinion and does not necessarily reflect the opinion or view of Slalom. -
Check if a user has a specific role
Hello,
Is it possible to check if a user has a specific role in MII 12.0?
For example if the user has the role "xmii Developers" I would do something more in a transaction than if the user doesn't have this role.
Thank you for your help.
Regards,
MatthiasHi Matthias Pröller ,
Are u finding difficulty to trace which role user is assigned to? If so, then u can refer Abesh's Blog.
OR
If you are writing Transaction to get user list based on Role , then u can do following
Create XML query.
Configure above XML Query in Transaction, in links map (XML Query) URL like given below
"https://Server:Port/XMII/Illuminator?service=admin&Mode=UserList&Content-Type=text/xml&group=XMII Administrators&IllumLoginName=loginId&IllumLoginPassword=pwd"
Regards,
Padma
Edited by: Rao on Mar 31, 2009 11:52 AM -
In SharePoint 2010 I created workflows that used the 'Create list Item' Action, which then set the Content Type ID (so I could create documents of various types in a document library).
We just switched to the SharePoint 2013 platform, and now the drop down for Content Type ID is blank in all of the workflows that are still using the SharePoint 2010 platform. Is there any way to create a list item with specific content
type? Even if I could just input a string into that field instead of using this blank drop-down. Please help!Hi Sarah,
According to your description, my understanding is that you cannot create a new list item with a specific content type using SharePoint 2010 Platform Workflow.
I tested the same scenario in my environment, and the Create List Item worked fine with the specific content type.
How did you create the content type?
Please check if the content type is added to the list/library the workflow associated with.
Best regards.
Thanks
Victoria Xia
TechNet Community Support -
I am trying to validate a user from SharePoint to see if a user exists within an AD group. SharePoint does not allow you to do this so I am using the:
using
System.DirectoryServices.AccountManagement;
to validate user existance within that AD group. I found the following method that allows me to validate but bombing on me:
public bool IsUserInGroup(string username, string groupname, ContextType type)
PrincipalContext context = new PrincipalContext(type);
UserPrincipal user = UserPrincipal.FindByIdentity( context, IdentityType.Name, username);
GroupPrincipal group = GroupPrincipal.FindByIdentity(context, groupname);
return user.IsMemberOf(group);
When I call my method, i get
An operations error occurred.
I read that it might be an impersination error but I have my web.config set up already with:
<
authentication mode="Windows" />
<
identity impersonate="true" />
Any suggestions from someone that has worked with that namespace on SharePoint? I just want to plainly check to see if a user is part of a certain group on AD from SharePoint.
Victor Palma“An operations error occurred. “ may suggest a COMException is occurred.
I wrote an simple console application that works:
static void Main(string [] args)
Console .WriteLine(IsUserInGroup("Administrator" , "Domain Admins" ));
public static bool IsUserInGroup(string username, string groupname)
var foundUser = false ;
var context = new PrincipalContext (ContextType .Domain, "DC" );
var group = GroupPrincipal .FindByIdentity(context, groupname);
if (group == null )
context.Dispose();
throw new Exception ("Group could not be found: " + groupname);
// GetMembers(true) is recursive (groups-within-groups)
foreach (var member in group.GetMembers(true ))
try
if (member.SamAccountName.Equals(username))
foundUser = true ;
break ;
catch (Exception )
// One of the members could not be retrieved, moving on...
group.Dispose();
context.Dispose();
return foundUser;
Reference:
Recursive Active Directory group membership using System.DirectoryServices in .NET 3.5(http://www.lessanvaezi.com/recursive-active-directory-group-membership-using-system-directoryservices-in-net-3-5/)
Another important notice:
How to use the System.DirectoryServices namespace in ASP.NET(http://support.microsoft.com/default.aspx/kb/329986)
Keep It Simple and Stupid. -
Unable to remove user from SharePoint Group using PowerShell
I am trying to remove a user from a SharePoint Group using PowerShell.
I can see the user in the Site Collection as part of the SharePoint Group, however, when I attempt to run the script, I get an error message stating "Can not find the user with ID: 10"
Below is the PowerShell script that I am using:
$url = "https://sharepointdev.spfarm.spcorp.com/sites/desitecoll"
$userName = "spfarm\sp2013_svc"
#$userName = "spfarm\spprofileimport";
$site = New-Object Microsoft.SharePoint.SPSite($url)
$web = $site.OpenWeb()
$siteGroups = $web.SiteGroups;
Clear-Host
$mySiteGroups = @();
foreach($group in $siteGroups)
Write-Host $group
$mySiteGroups += $group;
}#foreach
$members = $web.SiteGroups[$mySiteGroups[0]];
$owners = $web.SiteGroups[$mySiteGroups[1]];
$visitors = $web.SiteGroups[$mySiteGroups[2]];
#Remove the user from the specified SharePoint Group
$spUser = Get-SPUser -Identity $userName -Web $url
Write-Host $spUser.ID
Remove-SPUser -Identity $spUser -Web $url -Group $owners
$web.Update();
$web.Dispose();
Write-Host "User " $userName "removed from " $owners
Please advise.I had to update the code to the following because Get-SPUser was not working properly:
$url = "https://sharepointdev.spfarm.spcorp.com/sites/desitecoll"
$userName = "spfarm\spprofileimport";
$site = New-Object Microsoft.SharePoint.SPSite($url)
$web = $site.OpenWeb()
$siteGroups = $web.Groups;
Clear-Host
$mySiteGroups = @();
foreach($group in $siteGroups)
Write-Host $group
$mySiteGroups += $group;
}#foreach
$members = $web.Groups[$mySiteGroups[0]];
$owners = $web.Groups[$mySiteGroups[1]];
$visitors = $web.Groups[$mySiteGroups[2]];
#Convert the user name to an SPUser account
$spUser = $web.Site.RootWeb.EnsureUser($userName);
Write-Host $spUser.ID
Remove-SPUser -Identity $spUser -Web $url -Group $owners
$web.Update();
$web.Dispose();
Write-Host "User " $userName "removed from " $owners
Was I not using Get-SPUser correctly? -
Can we customize any other expect SharePoint Sites using Sharepoint Designer
Hi All,
Can we customize any other expect SharePoint Sites using Sharepoint Designer?
Thanks in Advance!As Hemmendra, the tool is specifically designed for SharePoint. Both this and another tool derive from an older utility called FrontPage, which was an early Web Authoring product, before the age of standards and the like.
The other product that evolved into a paid development tool but is now free is one called Expression Web. This can do more web specific stuff and may be of use for you. It was made a free product a year ago though and can be found here.
http://www.microsoft.com/en-gb/download/details.aspx?id=36179
What else were you looking to achieve?
Steven Andrews
SharePoint Business Analyst: LiveNation Entertainment
Blog: baron72.wordpress.com
Twitter: Follow @backpackerd00d
My Wiki Articles:
CodePlex Corner Series
Please remember to mark your question as "answered" if this solves (or helps) your problem. -
How to add js files to sharepoint page using sharepoint designer
how to add js files to sharepoint page using sharepoint designer
Upload the files to your site collection into the site assets library or into the style library, depending on perference.
Then you can include the JS files either in the master page, page tempalte or using web parts. -
How to get SharePoint Groups using Javascript in SP2013 ?
How to get SharePoint Groups using Javascript in SP2013 , not JSOM please
Here is the code that worked for me:
<script type="text/javascript">
var requestUri = _spPageContextInfo.webAbsoluteUrl + "/_api/web/sitegroups";
var requestHeaders = { "accept" : "application/json;odata=verbose" };
$.ajax({
url : requestUri,
contentType : "application/json;odata=verbose",
headers : requestHeaders,
success : onSuccess,
error : onError
function onSuccess(data, request){
var s='';
for (var i = 0; i < data.d.results.length; i++)
s +=data.d.results[i].LoginName+'\n';
alert(s);
function onError(error) {
alert("error");
</script> -
Check if user belongs to specific sharepoint group using designer workflow
Hi,
I am developing a SharePoint 2010 Designer workflow [Reusable workflow].
Can I check if the workflow initiator belongs to specific SharePoint group. Do we have any action/activity for this?
I have some business logic that needs to be executed if user initiating the workflow belongs to specific SharePoint group.
Any suggestions/pointers on this would be highly appreciated.
Regards, Ketan GandhiHi,
You will not able to see it OOTB. You can refer this link if you want this
workflow action.
http://spdactivities.codeplex.com.
Thanks.Please mark it as an answer if it helped. -
Is it possible to check if a user has a device font before using it?
It's all in the title really. I was hoping there might be a way to check if the user had a certain font already installed on there computer to try and save loading the font at runtime when not needed. Is this possible with Flex4 and the new TLF?
Thanks
OllieFont.enumerateFonts(true); will give you an array of device and embedded fonts.
-
Add user to sharepoint group using REST API
I am trying to add a user to sharepoint group with following code
serviceUrl= Appweb + "/_api/SP.AppContextSite(@target)/web/sitegroups("+GroupId+")/users?@target='host web'";
$.ajax({
url: serviceUrl,
type: "POST",
contentType: "application/json; charset=utf-8",
dataType: 'json',
body: "{'__metadata': { 'type': 'SP.User' },'LoginName':'i:0#.f|membership|'+email }",
headers: {"accept":"application/json;odata=verbose",
"content-type": "application/json;odata=verbose",
"X-RequestDigest":$("#__REQUESTDIGEST").val()
async: false,
success: function (data) {
alert('success');
error: function (data) {
alert('fail');
The request goes to error function. Response of the request is Microsoft.SharePoint.Client.InvalidClientQueryException and message is A node of type 'EndOfInput' was read from the JSON reader when trying to read the start of an entry. A 'StartObject' node was
expected
I tried the sample from following link but fail it
https://msdn.microsoft.com/en-us/library/office/dn531432.aspxHi,
Per my understanding, you might want to add an user to a SharePoint group in host web from a SharePoint Hosted App using REST API.
Here is a working demo for your reference:
var hostweburl;
var appweburl;
$(document).ready(function () {
//Get the URI decoded URLs.
hostweburl = decodeURIComponent(getQueryStringParameter("SPHostUrl"));
appweburl = decodeURIComponent(getQueryStringParameter("SPAppWebUrl"));
// Resources are in URLs in the form:
// web_url/_layouts/15/resource
var scriptbase = hostweburl + "/_layouts/15/";
// SP.RequestExecutor.js to make cross-domain requests
$.getScript(scriptbase + "SP.RequestExecutor.js", loadPage);
// Utilities
// Retrieve a query string value.
// For production purposes you may want to use a library to handle the query string.
function getQueryStringParameter(paramToRetrieve)
var params = document.URL.split("?")[1].split("&");
for (var i = 0; i < params.length; i = i + 1)
var singleParam = params[i].split("=");
if (singleParam[0] == paramToRetrieve) return singleParam[1];
function addUsersInGroup() {
var executor;
// Initialize the RequestExecutor with the app web URL.
executor = new SP.RequestExecutor(appweburl);
executor.executeAsync({
url: appweburl + "/_api/SP.AppContextSite(@target)/web/sitegroups(8)/users?@target='" + hostweburl + "'",
method: "POST",
contentType: "application/json; charset=utf-8",
dataType: 'json',
body: "{'__metadata': { 'type': 'SP.User' },'LoginName':'i:0#.f|membership|[email protected]'}",
headers: {
"Accept": "application/json; odata=verbose",
"content-type": "application/json;odata=verbose",
"X-RequestDigest":$("#__REQUESTDIGEST").val()
success: addUsersInGroupSuccessHandler,
error: addUsersInGroupErrorHandler
function addUsersInGroupSuccessHandler(data)
console.log(data);
var jsonObject = JSON.parse(data.body);
console.log(jsonObject);
function addUsersInGroupErrorHandler(data)
console.log(data);
var jsonObject = JSON.parse(data.body);
console.log(jsonObject);
Thanks
Patrick Liang
TechNet Community Support
Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
[email protected]. -
Securing AnyConnect VPN user access via specific LDAP groups in Active Directory?
Is there a brief tutorial on how to secure AnyConnect VPN access using Active Directoty security groups?
I have AAA LDAP authentication working on my ASA5510, to authenticate users against my internal AD 2008 R2 server, but the piece I'm missing is how to lock down access to AnyConnect users ONLY if they are a member of a specific Security Group (i.e. VPNUsers) within my AD schema.This looks fairly complete
http://www.compressedmatter.com/guides/2010/8/19/cisco-asa-ldap-authentication-authorization-for-vpn-clients.html
Sent from Cisco Technical Support iPad App -
How do I authenticate users in a specific AD group with Cisco ISE
I have ISE up and running authenticating properly. But right now it will authenticate and allow ANY account in Active Directory. I want to allow access to only users in a specific group in Active Directory. I have added the group under Administration>Identity Management>External Identity Sources>Active Directory>Groups. But, I have not been able to find a way to link membership in that group to the Authentication Policy rules.
Thanks for the reply.
I'm not getting AD as an option (see below). Any idea why that might be? -
Hi
If I have only login name of any user like - "Donamin\login_name".
If this user is not present in sharepoint portal.
How can I add this user to people or group column of any list or in any sharepoint group with permission?hi
got the issue
it should be like this -
string userloginname = @"DOMAIN001\vyankatesh_mujumdar"
using (SPSite oSpSite = new SPSite(site.ID))
using (SPWeb web = site.OpenWeb())
try
{ SPList lst = web.Lists["TestList"];
string userloginname = @"DOMAIN001\vyankatesh_mujumdar";
web.EnsureUser(userloginname);
SPUser oSPUser = web.SiteUsers[userloginname];
SPFieldUserValue FieldValueName = new SPFieldUserValue(web, oSPUser.ID, oSPUser.LoginName);
SPListItem oSPListItem = lst.Items.Add();
oSPListItem["Title"] = userloginname;
oSPListItem["People"] = FieldValueName;
oSPListItem.Update();
catch (Exception ex)
ExceptionManager.LogErrorInFile("--------Exception -------", bIsLogEnabled);
ExceptionManager.LogErrorInFile(ex.Message, bIsLogEnabled);
ExceptionManager.LogErrorInFile(ex.Source, bIsLogEnabled);
ExceptionManager.LogErrorInFile(ex.StackTrace, bIsLogEnabled);
ExceptionManager.LogErrorInFile("-------------------------------------------------------", bIsLogEnabled);
Thanks for all for the reply
Maybe you are looking for
-
How to Run both UCM Server and Webcenter Portal Services on single Weblogic
Hi, First i have installed Oracle UCM and configure it on Weblogic Server successfully. But after the installation of Webcenter Portal on same machine and Weblogic Server. UCM Server is not running it shows Forcefully shutting down error. Kindly help
-
Have a new iMac. can i use my old mini as an external cd/dvd drive?
Just got my new imac and have discovered it is without a cd/dvd drive. Since I have converted from a mac mini can I use the old mini as an external drive, and how do I do that if the response is yes?
-
Problems loading plugin on Austrian (German language) machines
I've just has a rather embarassing session of trying to show my site on PCs in Autria and I wondered if other people had had special problems with German language machines (other than trying to find the "Y"). We downloaded the JRE and netscape was am
-
Can't put CR2 files from Canon Rebel T5i on PSE 11? How do I get them to load?
I keep trying to put my CR2 files on photoshop elements 11 and I can't. It keeps saying my camera is not compatilble. I use a Canon Rebel T5i. How do I get it load? Do I need to update my program? I really need to get this images up and editted asap!
-
ITunes never opens up on my computer
I recently got a video iPod(30 GB) and tried installing the software. after installing everything iTunes wont open up. I even tried disabling my anti-virus but still nothing happens. does anyone know what i need to do? customer service hasnt been ver