Advertisements

Create a Custom Action to Satisfy Your “All People” Needs.

image

Thanks for the intro Carl! Much obliged! Well, in your SharePoint world, your “Pale Blue Dot” view of all of the people in your site collection is the “All People” view, you know, the User Information List.

Almost two months ago, I wrote an article on how the “All People” link in SharePoint 2010 is, well, it’s gone MIA. It is easy to get to via  link. And, if you’ve got one site collection to manage, well, its as simple as adding a link somewhere, like in a link list within a management site somewhere, or, up in the handy dandy bookmarking feature, in those fancy things all the kids are using these days, “web browsers”… whatever that means…? Anyways. So, you need to get there, but, wouldn’t it be nice and simple to add in a link to say, I don’t know, the Site Settings page? Wow! That’d be cool! Then I can access it with all of the other Users and Permissions links! Right in one place?! WOW!

image

So, the question becomes, how can we get it there? (HINT: I mentioned it in the title of this article!)

Ok, so I gave it away, shame on me, I spoiled the ending. Boo hoo. Yes, Custom Actions! That’s how we’ll get it there!

So, what to do? Well, not too much actually. The creation of Custom Actions in SharePoint 2010 and with Visual Studio 2010 has become, well, easy. Extremely easy in fact due to the fine folks who created the CKS:DEV project over at Codeplex. Why? Well, because it contains item types with fancy pants wizards to allow you to click a few buttons, and create a custom action project with ease. You really do not even need to be a developer to do this, it’s quite easy, and hey, I provide screenshots and code. Go ahead, do it!

So, let’s get started, shall we? Oh, you need a glass of water first. No problem. I’ll be here waiting for you.

… 15 minutes to get a glass of water? seriously? Did you pump it from the well?

Ok, so, make sure you have VS 2010 installed, as well as CKS:DEV. NO, I am not waiting this time. You lollygagged around with getting a glass of water last time… You had your chance!

 

First, create a new project in Visual Studio 2010

image

Then, create an Empty SharePoint Project
image

Oh, guess what you’re about to witness? Yes, you in the back in the Charlie Brown polo shirt! You’ve got it. The creation of my next codeplex project for Grace-Hunt (yes, I know, it’s been a while!)

And since we do not need to elevate privileges, or any of that fancy stuff required for a server-side deployment, we’re going to create this as a Sandboxed Solution…

image

Next, once our project is loaded in the Visual Studio IDE, let’s add a new item to the project.

image

Right click on your project, go down to Add, then select  New Item.

On the next screen you are presented with, make sure you have SharePoint and 2010 selected under Installed Templates.

image

Select Custom Action, and give it a name (such as UserInfoList). Then click Add.

Now, again, thanks to the fine folks who created CKS:DEV, we have wizards!

image

On the first screen on the wizard, we have 6 settings we are going to make use of, detail from here for each of these attributes: http://msdn.microsoft.com/en-us/library/ms460194.aspx

ID

Attribute

Description

1

Id

Optional Text. Specifies a unique identifier for the custom action. The ID may be a GUID, or it may be a unique term, for example, "HtmlViewer".

2

Title

Required Text. Specifies the end-user description for this action.

3

Description

Optional Text. Specifies a longer description for the action that is exposed as a tooltip or sub-description for the action.

4

GroupId

Optional Text. Identifies an action group that contains the action, for example, "SiteManagement". If it is contained within a custom action group, the value of the GroupId attribute must equal the group ID of the CustomActionGroup element.

For a list of the default custom action group IDs that are used in Microsoft SharePoint Foundation, see Default Custom Action Locations and IDs.

5

Location

Optional Text. Specifies the location of this custom action, for example, "Microsoft.SharePoint.SiteSettings".

If the CustomAction element contains a CommandUIExtension child element, the Location must start with "CommandUI.Ribbon". For a list of default locations that are used with the Server ribbon, see Default Server Ribbon Customization Locations.

If the custom action is a menu item or toolbar button, the possible options include EditControlBlock, NewFormToolbar, DisplayFormToolbar, and EditFormToolbar.

If it is contained within a custom action group, the value of the Location attribute must equal the location of the CustomActionGroup element.

For a list of the default custom action locations that are used in SharePoint Foundation, see Default Custom Action Locations and IDs.

6

Sequence

Optional Integer. Specifies the ordering priority for actions.

 

image

On the next page, we do not actually need to set this option, however, I wanted to, to showcase this functionality. This utilizes the SPBasePermissions class to show whether this can be viewed to the user, based on the permissions they have for this object, in this case, the site collection.

image

On the last screen, and this is the important part, we need to specify the URL we want to have our CustomAction link to, this is the URLAction element. The ~sitecollection is a Token. More information on what tokens can be used in a URLAction can be found on slide #30 of my Creating Custom Actions in SharePoint presentation.

image

Now that we’ve finished defining the custom action, we just have a couple of more things to do. Since we do not our feature to be called “Feature1”, right-click on Feature1 in the Solution Explorer, and choose Rename.

image

Type it in, hit enter, all good.

Next we want to remove Feature 1 from after the title of our feature. Double click on the UserInfoList feature we just renamed, and we get a designer view of our feature (new in VS 2010).

image

In the Title field, remove Feature 1 after our feature, and add a description. Also, change the scope from Web to Site, which means we will deploy our solution to the site collection. Which also means, this link will appear for all Users and Permissions sections throughout all of the site settings pages within our site collection.

image

Now for the money! Right click on the project and select Deploy.

image

Look at the output window to see if we had success or failure…

image

And now look at your site settings page – there is our new link!

And that’s it! I will have this project published to Codeplex within the next few days, so, please keep an eye out.

Advertisements

“All People” view in SharePoint 2010

One thing we have seemed to have lost is the “All People” link when managing users and groups from SharePoint 2007 in 2010, as shown below from a 2007 site.

image

However, in SharePoint 2010, this link does not exist… Have no fear however. If you have copy & paste skills, you can get back there. It still exists. Just copy the URL from your 2007 site

http://my2007site.sharepointyankee.com/_layouts/people.aspx?MembershipGroupId=0&FilterField1=ContentType&FilterValue1=Person

And drop the protocol, port, and host sections of the URL out, and use that with the protocol, host, and port of your 2010 site, and you are good to go.

http://my2010site.sharepointyankee.com/_layouts/people.aspx?MembershipGroupId=0&FilterField1=ContentType&FilterValue1=Person

Simple and easy way to get back to that view. Then just add this as a favorite, or, even better yet, create a CustomAction to add it into the toolbar, or site settings page in 2010.

%d bloggers like this: