.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Get Sharepoint Group by username

Posted By:      Posted Date: October 21, 2010    Points: 0   Category :SharePoint

Hi fella

I wanna get SpGroup name from username in visual studio workflow.

I used the following code

          SPGroupCollection grp = workflowProperties.Web.CurrentUser.Groups;        

            foreach (SPGroup group in grp)
                string groupName = group.Name;

but i always getting administrator's group.not user's.

pls help me to solve it...





View Complete Post

More Related Resource Links

Group Calendars in SharePoint 2010

One of the many requests I had in SharePoint 2007 was the ability to place SharePoint Calendars on top of each other like you can in Outlook 2007 saving you having to look at each and work out when the best time is for a meeting.

Sharepoint list group by column data ,display in webcontrol like panel or label


I  have a sharepoint list[Managers] with groupby sector column. like below




Each Sector group by column data i want to display in label or panel control.

How to do that ? how to write the logic?



Regards, Mansoor

How to get User group in SharePoint Designer 2010 within workflow?

Hi, How to get user group in sharepoint designer within workflow? Basically I have to compair that current user is belongs to particular group or not.  How can I get check user group in workflow's if condition? G. Goyal

In Sharepoint 2007 while creating a group "Give Group Permission to this Site" section is missing

I have a strange anamoly in Sharepoint 2007 but I am guessing I am missing some minor step since I am new to Sharepoint. I am trying to create a new group which I have done before successfully. 1.On the home page of the site,  I click Site Actions, point to Site Settings, and then click People and Groups. 2.On the New menu, I click New Group. 3.Type a name for the group, and then type a brief description of the group's attributes in About Me. 4.I change the owner of the group or click Browse to find an individual's account name. 5.In the Group Settings section, I click the options to specify who can see the members of this group and who can add or remove members. 6.In the Membership Requests section, I click the options (No, No) and no email address entered Here is the problem part: I am supposed to see  the "Give Group Permission to this Site section"  but I see only Create and Cancel buttons.   Can you please help why I do not see  "Give Group Permission to this Site section". Is there another way to assign group permission?

SharePoint 2007 to Access 2007 - Issues grouping by "Person or Group" field type/column

We are on SharePoint 2007 and using Access 2007.  The SharePoint list contains a column called Assigned Person, column type: Person or Group, single selection, displaying only the name 1) When we Open with Access and Export a copy of the data, then create a report from that table, we do not have the option to group on Assigned Person.  2) When we Open with Access and Link to data on the SharePoint site, then create a report from that list, when we group by Assigned Person... The same person has 2 groups - there are is no other grouping or sorts on the list, and i can't locate a correlation to another field to show why they would have to collections for the same person The Person or Group column sorts "from smallest to largest" as though it is a number field. The list is a task/activity tracking system we created custom for our needs.  We want to pull a weekly report, grouped by Assigned Person, but cannot get access to work.  We do not want to resort to anything more complex, as it takes a much longer process to have reports pulled by Chrystal or one of those types of applications.  And we cannot change out the field for something like a Choice column as the list already has a very large amount of content.  Can anyone assist? Is there a setting hiding somewhere that is causing the problem? 

scrollbar is not showing for sharepoint list with group by view

Hi, have created a Share point 2007 list having a huge data. I have created a group by view by grouping the data with category. My requirement is to show the data as web part on a page. When i did so, while expanding the group inside the web part, the web part is expanding. I want to keep the height and width of the web part fixed so that the layout of the page will not be ugly looking. But though I am putting the option for fixed height and width in the web part setting but I am not able to see the scroll bars. Where as I can see the height and width are fixed but could see a few data instead of all the data with scroll bar.   Please advice me if there is any solution or workaround.Deeptyranjan

Sharepoint group permissions priority

Here I have a small doubt. Hopefully I am not asking stupid question. I have two sharepoint groups say A and B. A has read only permissions and B has full control permissions. one user is in both the groups. If the document library have permissions to both the groups, which permisssions the user will get. Read only or full control? ThanksBest

Display Full Name in SharePoint instead of Domain\Username

My SharePoint 2010 server started displaying the users with the Domain\Username standard instead of using Full Name (as it did up to yesterday). This in all pages of the sites (persmission settings, document libraries, tasks, etc.) Does anybody knows how to force SharePoint to display users with the "full name" standard? Thank you.Plo

Logon to SharePoint 2010 requires \. Why?

We've installed a fairly large number of small SharePoint 2007 environments. All of these have had their own Active Directory, specified to <domainname>.local. These have been accessible from Internet, and have simply had a external DNS pointingwww.<domain>.com to the server.  In these SharePoint 2007 environments we've used Windows Authentication, and logging on has simply been a procedure of specifying username and password. It has worked just fine. However, in our first SharePoint 2010 environment, we're encountering odd problems. We use here NTLM authentication, and  domain name is <domain>.local. The domain name used in Internet iswww.<domain>.com, which points to the SharePoint 2010 environments frontend server. We'd like to login to the SharePoint environment with simple <username> and password, but it fails. We have to explicitely specify <domain>\<username> and then password to login. Why doesn't this work, and is there any relatively easy way to fix this without disturbing the environment? From logon attempts using simply username, these events appear in the Security event log: Log Name: Security Source: Microsoft-Windows-Security-Auditing Date: 7.5.2010 13:15:01 Event ID: 4625 Task Category: Logon Level: Information Keywords: Audit Failure User: N/A Computer: <COMPUTER>.<

Is there a way to obtain where in a sharepoint site a certain security group is used?

There is a sharepoint group that has been set up and is used throughout a single sharepoint occurance with many team sites and lists. It has orginated from AD and sent over to sharepoint with collection. The want to rename the group name. I have used it throughout the site. Is there a way to identify what sites and lists have been secured with this site so I do not have to go manually through site by site? Thanks, Angela

Create SharePoint Security Group populated by AD query

Is there any non-code way to create a SharePoint Security Group that is populated by an AD query? The "standard" way of getting the same "effect" is to create a group that contains an AD group but that does not allow members of a particular site to see who else is also a member of the site Any thoughts?

Sharepoint 2010 WorkFlow Task AssignedTo Windows Group doesnt send email notification

Hi, Which configuration would prevent sharepoint to send a notification when a workFlow task is assigned to a Windows Group with an email ? The same task with a single User send a notification. Thanks, Patrice      

MOSS 2007 - SharePoint Designer Workflow failing when using group vs individual user

I am creating a simple workflow in SharePoint designer that will email a selected user when a list is modified.  I am applying the condition "if modified by" in Designer.  This condition works fine and the email is sent when I select a specific user myDomain\username.  It does not work when I attempt to associate a SharePoint group with the "if modified by" filter. In my example the list has only one SharePoint group associated with it, this is the only group with permissions for the list.  The group contains multiple users. The workflow is successful with the following scenario: if modified by myDomain\user1 or if modified by myDomain\user2 The workflow fails with the follwoing scenario: if modified by mySharePointGroupName  (which includes myDomain\user1 and myDomain\user2) This would be an ungodly if statement with a large membership SharePoint group.  This would also be a nightmare as people leave the organization and their account credentials are left in the large if statement in the workflow.  Looking for the modified condition when associated with a group seems like the logical way of doing this. I also tried "myDomain\domain users" which accounts for all user in my domain, this failed as well. Any advice would be greatly appreciated.

Problem sending an email to all users of a sharepoint group

Here is what we did so far: 1. created an OU in AD and delegated full control to Sp service account 2. Configured incoming email settings 3. on sp site created a new group with full control permission 4. created an email distribution group for this group with an email address 5. in CA approved the distribution group to be created in OU 6. In Ad we can check the OU is there with the specified email address 7. added users to the group, but when we send an email to the group email address it does not forward to the group members. Please advice  

Mysite SharePoint 2010: Displayname shows domainname/username?


Hi !

I setting up MySite on SharePoint 2010 for my organization. MySite is our first priority to get up and going. Everything is installed and working.

- SharePoint installed
- Active Directory is synced

When I browse around for users in the search bar, everything looks fine. I can use the organization chart to browse up and down, and their names is all correct. 

Problem is: 
When a user connects to MySite for the first time, the MySite is obviously created and the user can start to add content and so on.
But - After the user logged in for the first time, his Displayname (property collected from AD) shows as "domainname/username" 

After we tried and tested a couple of users and they logged in, the organization chart is falling apart, and the displaynames are all changed to domainname/username. 


Anyone know what causes this?

a primary AD group should not be added to a SharePoint Site Group.....



as per http://msdn.microsoft.com/en-us/library/bb975136%28office.12%29.aspx and the problem we are facing:

Primary group membership In Active Directory, each user has a primary group. When the LDAP Role provider is used with Active Directory, a user's primary group is not included in the list of roles for the user. By default, a user's primary group is the Domain Users group. As a result, the Domain Users group is not a good choice to add to a SharePoint group when you are provisioning permissions because unless the user's primary group is changed, no user is returned in the membership of that role. For more information, see the primaryGroupID attribute in User Security Attributes.


My requirement is:-

I have  added  user 'us1' in an ADGroup  'A

InfoPath 2010, People Picker Control - problem with sharepoint group targeting



I have developed InfoPath 2010 web form with People Picker Control. I want to set sharepoint group which would be used in People Picker Control to search people. Ok, I set sharpoint site url and aftet that - select sharepoint group 'Test InfoPath group' I need. Everything works fine - I can select only people inside sharepoint group 'Test InfoPath group'.

Now I deploy my solutions (wsp package) on different site collection and sharepoint server installations. In this case People Picker Control can't find right sharepoint group 'Test InfoPath group'. Sometimes People Picker Control select another group, not that I have select in InfoPath Designer and sometimes People Picker Control select all users.

What's wrong with it and can I configure People Picker Control to select sharepoint group?

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend