Showing posts with label SharePoint 2010. Show all posts
Showing posts with label SharePoint 2010. Show all posts

Monday, October 24, 2011

Apply Permissions to Custom UI Links / Actions in SharePoint Menus and Settings Pages

This post explains how to incorporate permissions into custom links and actions added to the UI on menus, toolbars and default layout pages such as the Site Settings page in SharePoint 2010.  



 
Examples included in the post are:
  • Restricting custom links on list settings pages to only site collection administrators
  • Adding custom actions to the Document Library dropdown menu (ECB - Edit Control Block) that are displayed only to users with edit permissions on the document.
  • Displaying a link on the Site Actions menu only to users with access to manage  permissions for the current site.
  • Displaying a custom link on the List Actions menu for users with access to manage the list.
  • Display a link on the Site Settings page of a site to users with access to add and customise pages on the site, as well as apply themes and stylesheets to the site (Site Designers).

Tuesday, October 11, 2011

SharePoint 2010: Add User Control to Master Page Using SharePoint Designer 2010

In this article I explain the steps to include a custom User Control in a Master Page in SharePoint 2010 using SharePoint Designer.  

In my case, the example User Control I am adding to the Master Page in this tutorial is in the following location which would vary depending on the name and of the Control and the folder it is saved in:  “~/_controltemplates/SP2010_UserControl_Example/DynamicSiteTitle.ascx file”

SharePoint Designer 2010 Master Page User Control
Using SharePoint Designer 2010, open the Site and Master Page Library where the Master Page will be stored containing the User Control.  In this example, I am creating a copy of the default v4.master used in SharePoint 2010 in the root site Master Page Library and calling it v4b.master.





Open the Master Page you wish to modify by right clicking the and selecting the “Edit File in Advanced Mode” option.

Close to the top of the markup below the existing @Register / @Import tags, add the following line to register the User Control for use in the page.  Change the reference to the User Control file (.ascx) to point to your User Control if required:

<%@ Register TagPrefix="custom" TagName="DynamicTitle" src="~/_controltemplates/SP2010_UserControl_Example/DynamicSiteTitle.ascx" %>







Now that the User Control is registered, it can be included in the page by adding an element with the tag prefix and tag name specified when registering the control.  As the example User Control displays a dynamic title the tag and prefix have been named to suit, but can be something else if required.  The element in this case will look like:

<custom:DynamicTitle id="DynamicTitle1" runat="server"/>

The value of the id attribute can also vary, which should be unique for each instance that the control is included on the page if more than once.  

I have added the control to the Site Name placeholder (PlaceHolderSiteName) replacing the existing Property used to display only the title of the current site, as the custom control performs a similar function.

The resulting code looks like:

<h1 name="onetidProjectPropertyTitle">
<asp:ContentPlaceHolder id="PlaceHolderSiteName" runat="server">
<custom:DynamicTitle id="DynamicTitle1" runat="server"/>
</asp:ContentPlaceHolder>
</h1>



Save the Master Page, and enable it if required on a SharePoint Site.

The Custom Control should be displayed where you placed it on the Master Page.  In this case, the Site title (Team Site), List/Library (Site Pages) and page title (Home) are displayed in the banner of the site.



For assistance with creating a User Control, please see the following tutorial which contains instruction on how to create the example User Control used in this article that displays a dynamic title of the current site, list and page / list item if applicable for demonstration purposes:

Developing a custom User Control for SharePoint 2010

The tutorial covers building a basic User Control from scratch using Visual Studio, and also includes instructions to include the control on an Application page or Master Page.  A User Control can be add directly to any .aspx page in SharePoint as well by following the same steps described in this tutorial.

It is also possible to complete these steps in a Master Page included in a solution developed using Visual Studio 2010, which can then be activated on specific sites as a feature, but is not covered in this article.  See this article by Mirjam: Deploying a custom master page in SharePoint 2010 for instructions on how to add a Master Page to a Feature using Visual Studio, which also include an event receiver to use the new Master Page when the Feature is activated on a SharePoint site.

Related:

Saturday, September 17, 2011

Visual Studio 2010 Installation Errors & SharePoint 2010 "Service Unavailable" after VS 2010 Install

Last night I set up a fresh development environment for SharePoint 2010, but ran into a few issues when I came to install Visual Studio 2010 on the server, and also SharePoint 2010 once Visual Studio was installed, although there were a number of possible causes of SharePoint stopping working during the process.  In this article, I explain the steps taken to resolve issues with the Visual Studio 2010 installation and the SharePoint 2010 environment.

Server Configuration
The server is configured with Windows Server 2008 Standard as the operating System, which was created from a snapshot taken from the base install some months ago.  In the “base install”, I had installed MS SQL Server 2008, and SharePoint 2010 which were both working fine at the time the snapshot was created.

The problems and steps taken to resolve:
After creating a new VM from the snapshot and testing SharePoint, I was able to load the root SharePoint site as expected.  No other sites existed in the environment at this point as it was a fresh install of SharePoint when the snapshot was taken.  

My first attempt at installing Visual Studio 2010 failed before it even started, as the Windows Installer was in use, or a reboot was required.  Due to the time between making the snapshot and creating this VM, a number of updates had been released by Microsoft that were applicable to the server.  Rebooting the server resulted in many updates being installed.  I also activated the Windows Server 2008 installation after the reboot as the previous product key had expired.  My second attempt at installing Visual Studio also failed when attempting to install the first of the long list of required components.  I rebooted again to find that there were still some updates that needed to be configured on the server even though there was no notification of this requirements after the initial reboot.  

A number of updates relating to the SharePoint Environment and dependent components had been  installed for the .NET Framework (KB958484), Office 2010 one for SharePoint Foundation 2010 (KB2553014: Update for Microsoft SharePoint Foundation 2010), Silverlight, SQL Server Service Packs, a bunch of security updates for Windows and SharePoint Server 2010, and the list goes on).

Once the updates had installed, I then ran the SharePoint Configuration Wizard which included steps to complete updates to the SharePoint installation as a result of the Windows updates relating to the SharePoint Foundation 2010 components.

The Visual Studio 2010 Installation also proceeded at this point without error, but when I attempted to load the SharePoint 2010 environment in the browser after completing the installation, I was greeted with a “Service Unavailable” error (500).  A quick look at the services for IIS, SharePoint and the SQL server indicated that they were running, and restarting the services and the server didn’t resolve the issue.

An IIS Reset also didn’t help with the situation, as the main SharePoint site appeared to be running in IIS.  My next step was to check the Application Pools used by the SharePoint environment, which I found that they were all in the “stopped” state.  

Starting the Application Pools allowed the SharePoint environment to become responsive again when accessed in the browser, but when it finally loaded, I received the “An unexpected error has occurred” message.  Turns out that I was probably just a little impatient after restarting the Application Pools, as a simple refresh of the page after waiting for a few seconds allowed the root SharePoint 2010 site to load successfully again.

Monday, August 16, 2010

InfoPath SharePoint Development

SharePoint News & Development Resources
DevSharePoint.com provides the latest SharePoint news and resources. Stay up to date with SharePoint 2010, MOSS 2007, WSS, SharePoint Designer (2007/2010), InfoPath.

InfoPath & SharePoint Development Tutorials, Resources & How To's
InfoPathSharePoint.net provides the latest InfoPath development tutorials, InfoPath Form Services administration tips, tricks and how to's. InfoPath SharePoint Integration: Integrate InfoPath Forms with SharePoint lists, libraries & workflow.

SharePoint & InfoPath News & Resources
SharePoint Administration, Development, Design & Customization Resources from around the internet. SharePoint & InfoPath News. InfoPath SharePoint Integration. InfoPath Form Template Design. InfoPath Form layouts, design tips & techniques.

Thursday, January 7, 2010

SharePoint Forums, Blogs and Online Communities

SharePoint Forums

The following page provides a comprehensive list of websites hosting popular forums relating to SharePoint. Learn how to customise, develop and administer SharePoint environments from industry experts by browsing through existing threads, or by posting a new thread if you have a question which hasn't been answered in one of the forums. All of the forums listed are free to join and contribute.

Forums relate to WSS, MOSS 2007 and SharePoint 2010, and include the official Microsoft product and Technologies and other forums such as the SharePoint Development & Programming, SharePoint Setup and Administration, SharePoint Design and customisation.


SharePoint Blogs

The SharePoint Blogs listed on the page are predominantly SharePoint MVPs, with years of experience, and many useful articles, tips and tutorials to help when customising, developing and administering SharePoint.


SharePoint Groups

There are many groups (newsgroups) available that contain information, and references to other useful information and resources that can help when customising, developing or administering SharePoint. The groups provided on the following page are moderated to ensure that inappropriate or illegal content, including spam is not added to the groups.