Interactive Silverlight STSADM Technical References for MOSS 2007 and WSS 3.0

Published just today on Microsoft TechNet, are two great interactive technical references for MOSS 2007 and WSS 3.0 STSADM command options. If you use the STSADM utility at all, and ever need a reference, this is an excellent option.

There are two separate versions, one limited to WSS 3.0 commands, and a second for MOSS 2007 only commands available via STSADM.

WSS 3.0: http://technet.microsoft.com/en-us/windowsserver/sharepoint/dd418924.aspx

MOSS 2007: http://technet.microsoft.com/en-us/office/sharepointserver/cc948709.aspx

 

SharePoint SPBasePermissions Enumeration

When I presented my session on Developing Custom Actions within SharePoint at the Boston SharePoint Saturday conference, I had mentioned a link for a listing of SPBasePermissions that is on MSDN, within the WSS 3.0 SDK, for use with the Rights attribute within the CustomAction element. This attribute defines what permissions are required for the Custom Action to be visible to users.

That link can be found here: http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spbasepermissions.aspx

For others reference, and my own personal reference, I have a copy of this listing of SPBasePermissions here.

Member Name

Description

AddAndCustomizePages

Add, change, or delete HTML pages or Web Part Pages, and edit the Web site using a Windows SharePoint Services–compatible editor.

AddDelPrivateWebParts

Add or remove personal Web Parts on a Web Part Page.

AddListItems

Add items to lists, add documents to document libraries, and add Web discussion comments.

ApplyStyleSheets

Apply a style sheet (.css file) to the Web site.

ApplyThemeAndBorder

Apply a theme or borders to the entire Web site.

ApproveItems

Approve a minor version of a list item or document.

BrowseDirectories

Enumerate files and folders in a Web site using Microsoft Office SharePoint Designer 2007 and WebDAV interfaces.

BrowseUserInfo

View information about users of the Web site.

CancelCheckout

Discard or check in a document which is checked out to another user.

CreateAlerts

Create e-mail alerts.

CreateGroups

Create a group of users that can be used anywhere within the site collection.

CreateSSCSite

Create a Web site using Self-Service Site Creation.

DeleteListItems

Delete items from a list, documents from a document library, and Web discussion comments in documents.

DeleteVersions

Delete past versions of a list item or document.

EditListItems

Edit items in lists, edit documents in document libraries, edit Web discussion comments in documents, and customize Web Part Pages in document libraries.

EditMyUserInfo

Allows a user to change his or her user information, such as adding a picture.

EmptyMask

Has no permissions on the Web site. Not available through the user interface.

EnumeratePermissions

Enumerate permissions on the Web site, list, folder, document, or list item.

FullMask

Has all permissions on the Web site. Not available through the user interface.

ManageAlerts

Manage alerts for all users of the Web site.

ManageLists

Create and delete lists, add or remove columns in a list, and add or remove public views of a list.

ManagePermissions

Create and change permission levels on the Web site and assign permissions to users and groups.

ManagePersonalViews

Create, change, and delete personal views of lists.

ManageSubwebs

Create subsites such as team sites, Meeting Workspace sites, and Document Workspace sites. 

ManageWeb

Grant the ability to perform all administration tasks for the Web site as well as manage content. Activate, deactivate, or edit properties of Web site scoped Features through the object model or through the user interface (UI). When granted on the root Web site of a site collection, activate, deactivate, or edit properties of site collection scoped Features through the object model. To browse to the Site Collection Features page and activate or deactivate site collection scoped Features through the UI, you must be a site collection administrator.

Open

Allow users to open a Web site, list, or folder to access items inside that container.

OpenItems

View the source of documents with server-side file handlers.

UpdatePersonalWebParts

Update Web Parts to display personalized information.

UseClientIntegration

Use features that launch client applications; otherwise, users must work on documents locally and upload changes. 

UseRemoteAPIs

Use SOAP, WebDAV, or Microsoft Office SharePoint Designer 2007 interfaces to access the Web site.

ViewFormPages

View forms, views, and application pages, and enumerate lists.

ViewListItems

View items in lists, documents in document libraries, and view Web discussion comments.

ViewPages

View pages in a Web site.

ViewUsageData

View reports on Web site usage.

ViewVersions

View past versions of a list item or document.

 

Getting the out of a SharePoint List

I was working recently on a project for a client, to build a feature that will create several list templates, content types, and instances of those lists. To do so, I used a great new utility that can be found on CodePlex, written by Jeremy Thake and Rich Finn, that will handle this for you. Better than the SharePoint Solution Generator that ships with VSeWSS (Visual Studio extensions for Windows SharePoint Services).
I used SPSource (the above mentioned program) to extract the content types, list templates, and list instances with ease, just needing a few minor tweaks, but I also had a different issue. I needed to populate those list instances with the data that currently existed within those lists. Jeremy Thake had pointed out that this could be done easily with PowerShell, but there is also another method that works easily enough, without requiring code.
To do so, go to your list which contains the data, and then go into the settings for that list, and save the list as a template, including the content.
Once you have created the list template, go to the list template library, and download the STP file that was created. Now, here is the trick, rename that file from Listname.stp to Listname.stp.cab. STP files are nothing more than cabinet files.
From: image
To: image
Once it has been renamed, open the cabinet file in your favorite compression utility, and open the Manifest.XML file that is inside it in your favorite XML editor. SharePoint Designer works great for this, as there is a quick utility to clean up the XML off of your right-click context menu to Reformat XML.
image
Once you have a nice clean view, do a search for <Data>, and you will then see the <Data> which you can then paste into your ListInstance element within your solution, and you have your data rows from your list, which will be added into the list when the list instance is created.
Copy everything within the <Data> element, including the <Data> tags, starting here (see below), and you should be good to go.
image
I generally trim off all of the fields that are not needed, and just keep my fields which I am using, for example, in the above, just trimming out everything but my fields. Which should generally all appear at the top of the <Row> element, as shown below.
image
All of the system fields will be generated automatically, and you do not run the risk of trying to push data into a list that is not supported, such as Created By field authors not being in the sites or farms where these are deployed to, or specifying the Attachment when the resulting list does not support them, you may receive an error on feature activation.
I am eventually planning to write a PowerShell script, or an executable to take care of this, and when I do, I will post about it here, and publish it to our CodePlex site.

“SharePoints” for the week of April 26th, 2009

Finally, I am on vacation, but wanted to share a few tidbits of information this week from the Microsoft world that should be of interest to my readers.

MOSS 2007 and WSS 3.0 Service Pack 2 Released on 4/28/09
That is correct, the next service pack was released for SharePoint, with many updates and fixes and updates in the ways of performance, compatibility, and additional functionality. There are several pages at Microsoft for this information, but Joel Oleson has put together the best post I have seen so far about aggregating information for WSS SP2, so I will send you over there for download links and other information: WSS & MOSS SP2 is Available – 5 No Brainer Reasons to Install

MOSS 2007 and WSS 3.0 SDK 1.5 Now Available
The next release of the MOSS and WSS SDKs have been released! Here are links to both the online versions and the downloadable CHM versions.

Online Versions
Office SharePoint Server 2007 SDK
WSS 3.0 SDK

Downloadable CHM Versions
Office SharePoint Server 2007 SDK
WSS 3.0 SDK

Windows 7 RC Now Available
And finally to end my “SharePoints” for this week, Windows 7 Release Candidate is now available through MSDN.

Hope you have found these useful! Back to vacation for me…

“SharePoints” for the week of April 12, 2009

I told myself that I wouldn’t just post links on this blog, I wanted to load it up with some good content first, as I didn’t want to become one of “those” blogs, and think I have done that pretty well to date.

However, I enjoy passing along good information when I find it, and do not like to make single posts about a single link here and there, so, every so often, I will be posting “SharePoints”, which will be a roundup of newsworthy-news, SharePoint links (current, and not so current), and other tidbits of SharePointy information. This will not be a weekly, or even monthly occurrence, so fear not. Most likely as some “filler” to pass along information when I do not have much else to post, a great example being that over the past several weeks I have been heads down on several big projects, and have not had the time to get much out there other than client work, and giving my home office a complete makeover.

Now, onto the Points…

First, the biggest news items to come out of the Microsoft SharePoint Team Blog (if you are not reading it – you should) this week. If you are reading this blog, I even have a little widget on the left side of the page that displays posts from them.

Microsoft SharePoint “14” is now Microsoft SharePoint 2010
That is correct, "Office" was dropped from the naming convention for the next version of SharePoint. Rest in peace odd acronym, we’ll miss you.

Service Pack 2 for Microsoft Office SharePoint Server 2007 and Windows SharePoint Services 3.0 due to ship April 28th
The long awaited Service Pack 2 for SharePoint is due out later this month! This Service Pack is loaded with fixes and performance improvements, as well as additional browser support (IE8, FireFox 2.0, FireFox 3.0). This post however is just a link to the Office Sustained Engineering blog, which has the real meat and potatoes. Go directly to it here: http://blogs.technet.com/office_sustained_engineering/archive/2009/04/16/service-pack-2-for-the-2007-microsoft-office-system-due-to-ship-april-28th.aspx

To add to that, as I know you will no doubt see the FireFox support in there, this is just adding level two support into the browser compatibility matrix for SharePoint, this still means that not everything will work as good as it does in IE, however, they are providing better support. IE8 is, of course, going to be in the level one support browser compatibility matrix.

And the last bit of information I wish to pass along at this time, is a link to a new CodePlex project I came across, SharePoint Solutions Manager – WSP Manager, that allows for SharePoint solution package management from the desktop. No more needing to fuss with STSADM (is it deletesolution or removesolution?) or go into Central Administration to manage your solutions, this can all be done from the desktop. More information and to download the project (source and executable) here: http://solutionmanager.codeplex.com/

This tool uses the object model to manage solutions, so this is required to run from the SharePoint server itself, not on your client machine.

And that’s a wrap for the first “SharePoints” from me… hopefully I will have some more time in the near future to post some additional content.

 

SharePoint Designer 2007 is Now FREE!

I wanted to wait until after April 1st for obvious reasons to blog about about the chatter I was hearing, and sure enough, it was no joke. SharePoint Designer 2007 is now free.

This is both good and bad. Good – because everyone can save on licensing costs, and bad, because it extends a lot of power out to site owners and designers. A lot of damage can be caused to a site by using SharePoint Designer.

Based on that, Robert Bogue [SharePoint MVP], has a great post regarding SharePoint Designer governance, which can be found here: http://www.thorprojects.com/blog/archive/2008/02/12/sharepoint-designer-and-governance.aspx

And with governance in mind, you may want to think about locking down your installation to control the usage of SharePoint Designer. Here is a great post from the SharePoint Designer Team Blog that talks about how to lock down SharePoint Designer within your SharePoint environment: http://blogs.msdn.com/sharepointdesigner/archive/2008/11/25/locking-down-sharepoint-designer.aspx

Updated 4.4.09 – Woody Windischman, who quite literally wrote the book on Microsoft Office SharePoint Designer, put together a great post surrounding the news of this tool now being free. I encourage everyone to read it here: http://woodywindy.spaces.live.com/blog/cns!773832677F575173!633.entry

And finally, the link to download SharePoint Designer 2007, for free: http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=baa3ad86-bfc1-4bd4-9812-d9e710d44f42

 

Extending SharePoint Designer Workflows

Building out workflows using SharePoint Designer is a great way to create basic, and even complex workflows for SharePoint without having to know C# or VB, or ever having to open Visual Studio. Sure, there are some drawbacks, such as ease of reusability, but, this extends the power of SharePoint down to non-developers to be able to drive business processes in SharePoint.

Like SharePoint itself, SharePoint Designer built Workflows can be extended as well, to create custom actions to do more with SharePoint Designer workflows than what comes out of the box.

The main point of this post is to direct you to two great projects on CodePlex that have done just that:

Both of these projects fill some of the voids with SharePoint Designer workflow actions, such as the ability to send emails with file attachments or list item attachments, start another workflow.

 

Programmatically Disabling or Enabling Site Search Visibility

The following code snippets are from a web part I built for a client, to assist them with generating new sites. There were new sites being created a few times a day, that all needed to follow similar configurations, but, were all based on the blank site template. Security and other things needed to be modified easily from a single, central interface, which only Site Collection Administrators could access. Each site had to follow several different business rules, and almost every one needed to apply a different set of these, so thus, the web part was created to handle this, as creating site definitions for every possible outcome of the business rules, would have required a new site definition for almost every one of the hundreds of sites that were being created.

One of the thing they needed to be able to manage from their initial configuration, is to be able to allow or not allow search visibility into that site.

The following code snippet will allow you to do just that. (web below is a reference to the specific SPWeb object). Some definition, as well as links to the WSS 3.0 SDK are below the code snippet.

   1: web.AllowAutomaticASPXPageIndexing = true;
   2: web.ASPXPageIndexMode =WebASPXPageIndexMode.Always;
   3: web.NoCrawl = false;
   4: web.Update(); 

By setting AllowAutomaticASPXPageIndexing to true, this will allow indexing of the ASPX pages within the site by the search crawler.

ASPXPageIndexMode specifies the type of page indexing that will occur. Check this reference in the WSS 3.0 SDK which specifies all values possible for WebASPXPageIndexMode. By setting this to Always, ASPX page indexing is always enabled.

Setting SPWeb.NoCrawl, if set to false, will allow crawling of the site.

Now, using the combination of the three above, this will allow indexing of everything, including the ASPX pages within the site to be crawled. If you wanted to crawl everything else within the site, however, did not want to crawl the ASPX pages themselves, you would use the following:

   1: web.AllowAutomaticASPXPageIndexing = false;
   2: web.ASPXPageIndexMode =WebASPXPageIndexMode.Never;
   3: web.NoCrawl = false;
   4: web.Update(); 

 

Web Part Gallery Permissions – Something to think about…

A common configuration for my clients is to have an external facing site collection, which aggregates project sites for their vendors and customers that they interact with to collaborate on projects, for example: https://partners.company.com. Where each of the sub-sites below the top level site have specific permissions configured to only allow the external users related to a particular project only into those sites, so those users have no idea what other clients, vendors, etc., you are managing sites for.

There are some sites which are extremely customized from a basic project style template, and/or site definition, and for those sites, there may be quite a few sub-sites. In those cases, it usually makes sense to put reusable web parts into the web part gallery for that site collection, to make them easy to access.

For instance, a Content Query Web Part which displays data out from a source list with data that is relevant to all of those sites, or filtered to display some of the content out to different sites. Instead of rebuilding, or exporting/importing the web part each time, dropping it into the web part gallery makes access to it easy.

If you then give control to the external users of that site to add web parts to that site, they can then see those web parts, and even add them to their pages when attempting to add web parts to their sites. If you have these web parts grouped or named based on the client/partner/vendor/project, they will be able to see those names. Unless they have access however, they will not be able to view the content from those sites if the web part is pulling any data from them, thanks to security trimming.

So, if you are using those sorts of naming and grouping conventions with the web part gallery under this type of scenario, you may want to modify the permissions of those web parts in the gallery to only users who should be seeing them.

This can be done by going to the Web Part Gallery at the Site Collection Level, selecting the edit link of the web part, and clicking on the Manage Permissions link within the toolbar at the top of the edit page:

image

From there, select Edit Permissions from the Actions menu

image

And you can then add/remove permissions as needed, thus allowing you to limit exposure of clients/partners/vendors to those sites that should be seeing them.

 

Combining Multiple CustomAction Elements Together

I’ve been slowly, but surely, getting the questions asked during my SharePoint Saturday Boston presentation, so, here goes the next one.

Can you combine multiple custom actions within a feature?

YES! You sure can! In my 4th demonstration (Custom Action Groups), I showed this within my ElementManifest file (manifest.xml), where I defined a CustomActionGroup, as well as 4 additional CustomAction elements within a single manifest file. See code example below:

   1: <?xml version="1.0" encoding="utf-8" ?>
   2: <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
   3:   <CustomActionGroup Id="HelpResources"
   4:        Location="Microsoft.SharePoint.SiteSettings"
   5:        Title="CustomAction Resources on MSDN" />
   6:  
   7:   <CustomAction Id="CustomActionLocsAndIds" 
   8:                 Title="Custom Action Locations and Ids" 
   9:                 GroupId="HelpResources" 
  10:                 Location="Microsoft.SharePoint.SiteSettings" 
  11:                 Sequence="0">
  12:     <UrlAction Url="http://msdn.microsoft.com/en-us/library/bb802730.aspx"/>
  13:   </CustomAction>
  14:   
  15:   <CustomAction Id="CustomActionElement"
  16:                 Title="CustomAction Element"
  17:                 GroupId="HelpResources"
  18:                 Location="Microsoft.SharePoint.SiteSettings"
  19:                 Sequence="1">
  20:     <UrlAction Url="http://msdn.microsoft.com/en-us/library/ms460194.aspx"/>
  21:   </CustomAction>
  22:   
  23:   <CustomAction Id="CustomActionGroupElement"
  24:                 Title="CustomActionGroup Element"
  25:                 GroupId="HelpResources"
  26:                 Location="Microsoft.SharePoint.SiteSettings"
  27:                 Sequence="2">
  28:     <UrlAction Url="http://msdn.microsoft.com/en-us/library/ms438085.aspx"/>
  29:   </CustomAction>
  30:  
  31:   <CustomAction Id="HideCustomAction"
  32:                 Title="HideCustomAction Element"
  33:                 GroupId="HelpResources"
  34:                 Location="Microsoft.SharePoint.SiteSettings"
  35:                 Sequence="3">
  36:     <UrlAction Url="http://msdn.microsoft.com/en-us/library/ms414790.aspx"/>
  37:   </CustomAction>
  38: </Elements>

The person who asked this question had a business need to create a lot of custom actions, however, did not want to have a feature built for each one, even though features are handy ways of deploying functionality to SharePoint, if you have hundreds of features, that can become a management nightmare.

I also mentioned, that what you can do is separate these out into functional ElementManifest files – as you can have any number of them defined in your feature, and they do not all need to be named elements.xml, or manifest.xml. A good example of this can be seen in the 12 Hive FEATURES folder, looking at some of the built in CustomAction elements and CustomActionGroup elements.

For instance, if you wanted to break out your manifest definition files into one for each CustomActionGroup, you can do so easily, by specifying different files – code example below.

   1: <?xml version="1.0" encoding="utf-8" ?>
   2: <Feature xmlns="http://schemas.microsoft.com/sharepoint/"
   3:          Id="{FFC864FD-C78D-4fd0-8F18-963D1EA59E0C}"
   4:          Title="SPS.CustomActionGroup"
   5:          Description="Custom Action Grouping example"
   6:          Scope="Site"
   7:          Version="1.0.0.0"
   8:          Hidden="false"
   9:          >
  10:   <ElementManifests>
  11:     <ElementManifest Location="MSDNResources.xml"/>
  12:     <ElementManifest Location="BlogResources.xml"/>
  13:     <ElementManifest Location="TwitterResources.xml"/>
  14:   </ElementManifests>
  15: </Feature>

 

This will make not only the management of features easier within SharePoint as far as managing what gets activated, also the management of the solution as well, so you are not managing 400 CustomAction elements within a single file, you can break them out as needed.

And to answer the question before it gets asked in this entry’s comments – the CustomActionGroup does not need to be defined within the same file as its CustomAction elements. You could break it down into CustomActionGroups.xml and CustomActions.xml if you’d like to separate them out.

Again – the names of the ElementManifest XML definition files do not matter – as long as they are referenced within the feature.xml file (this filename MUST be feature.xml), then you are all set. They really do not even need to have an XML definition, as long as it is declared at the top of the XML file, they will be interpreted as XML files.