Monthly Archives: June 2011

Need a SharePoint training site?

Microsoft has developed the Productivity Hub to help support your ongoing end user training efforts.

The Hub is a SharePoint Server site collection that serves as a learning community and is fully customizable. It provides a central place for your training efforts, and includes training content from Microsoft’s core products. Microsoft also provides ongoing and updated content packs.

The Hub uses SharePoint Server’s social networking capabilities, such as blogs and discussion groups. In addition, it offers the Coach program, a change management feature to help you train end users to self-help, reducing the burden on your training and IT staff. The Coach program impacts productivity in a collaborative and positive way.

The 2010 version of the Productivity Hub includes a quiz feature, a section called ‘Get it Done’ that offers training for tasks such as email management and collaboration, and also features Silverlight. There will be a non-Silverlight version of the 2010 Hub delivered in late June.

http://www.microsoft.com/downloads/en/details.aspx?familyid=4AAA9862-E420-4331-8BC3-469D7BAE0FF1&displaylang=en


Prevent sites from being deleted with code

Business Requirement:

Site Owners are deleting sites when they shouldn’t be. A governance process exists to approve the deletion of a site and should be used, but it’s not always happening. This causes documents and other information to be lost causing confusion when Users search for the deleted content.

Solution:

Add an event receiver to prevent users from deleting a site.

Steps:

1. Open Visual Studio 2010 and create a new EventReceiver project

2. Point to the correct URL and set to farm solution

3. Select “Web Events” and check “A site is being deleted”

4. Add the following code to the “WebDeleting” method.

public override void WebDeleting(SPWebEventProperties properties)
{

try
{
properties.Cancel = true;
properties.ErrorMessage = “Not Allowed!”;
}

catch (Exception ex)
{
properties.Cancel = true;
properties.ErrorMessage = ex.Message.ToString();
}
}

5. Change the scope of your feature to “Site” to include all sites in a site collection

6. Deploy your solution, navigate to site settings, and try to delete your site.


I am just using the standard error page which may work for you, but you can always create a custom error page if needed. I hope this helps you out!


Add new Item to a list – Code Snippet

I am capturing code snippets that I can easily reference in the future. I have created a category called “Code Snippet” to find these quickly. This is the base code to add a new item to an existing list.

//Code Snippet to add a  new item to a list

using (SPSite site = new SPSite(“mySiteURL”))
{
 using (SPWeb web = site.OpenWeb())
 {
                SPList listToAddItem = web.Lists[“myListToAddItem”];
                SPListItem itemBeingAdded = listToAddItem.Items.Add();
                itemBeingAdded[“myField”] = “myValue”;
                itemBeingAdded.Update();
 }
}


SharePoint 2010 – Folders vs. Metadata

SharePoint 2010 – Folders vs. Metadata <– This search will get you a ton of results from google. 

For a while I thought about ditching folders and only using metadata was the way to go, but that doesn’t work with all business requirements. Metadata should always be included, but sometimes folders are needed too. Below are a couple of questions that lead me down the path of including folders in a document library.

Will the users that have access to the document library have access to ALL documents in that library?

If the User responds “No” then I’m heading down the folder path. Security is one area metadata falls short. You can set security at the document level, but who wants to do that? I would rather have a folder and set the security on that. 

Will you use the “Explorer View”  as your main source to view documents?

I don’t know if you’ve ever looked via the “Explorer View” after a 500 or so documents have been added to a document library, but it’s useless without some kind of structure. It’s a laundry list of files and the users are forced to look at names of files to try to figure out what it is.