Showing posts with label custom. Show all posts
Showing posts with label custom. Show all posts

Friday, 2 September 2011

Create custom permissions – for SharePoint

It’s been a while since we’ve published one of iTech-Ed Associate Darren Pritchard’s SharePoint 2007 beginners’ guides. This time he’s explaining custom permissions and how to create them.

Let’s start off by defining what we’re talking about. Specifying custom permission levels give you more control over the degree of access users can have to SharePoint sites, site collections, or site content. In effect, you create a new security group.

So, let’s run through the steps:
  1. From the site collection click ‘Site Actions’ 
  2. Click ‘Site Settings’
  3. Under ‘Users and Permissions’ click ‘Advanced Permissions’ 
  4. You will then see a list for permission level group
  5. Select the ‘Settings’ drop down
  6. Click ‘Permission Levels
  7. Click ‘Add a Permission Level’
  8. You will then be able to create your own security group.

It’s worth remembering that only this site and all its sub-sites will have access to your new group.

Below is a list of permissions that can be set. Please note that selecting one may also result in others being selected because they are required as part of your selection.

List Permissions:
  • Manage Lists – create and delete lists, add or remove columns in a list, and add or remove public views of a list.
  • Override Check Out – discard or check in a document that is checked out to another user.
  • Add Items – add items to lists, add documents to document libraries, and add Web discussion comments.
  • Edit Items – edit items in lists, edit documents in document libraries, edit Web discussion comments in documents, and customize Web Part Pages in document libraries.
  • Delete Items – delete items from a list, documents from a document library, and Web discussion comments in documents.
  • View Items – view items in lists, documents in document libraries, and view Web discussion comments.
  • Approve Items – approve a minor version of a list item or document.
  • Open Items – view the source of documents with server-side file handlers.
  • View Versions – view past versions of a list item or document.
  • Delete Versions – delete past versions of a list item or document.
  • Create Alerts – create e-mail alerts.
  • View Application Pages – view forms, views, and application pages. Enumerate lists.

Site Permissions:
  • Manage Permissions – create and change permission levels on the Web site and assign permissions to users and groups.
  • View Usage Data – view reports on Web site usage.
  • Create Subsites – create subsites such as team sites, Meeting Workspace sites, and Document Workspace sites.
  • Manage Web Site – grants the ability to perform all administration tasks for the Web site as well as manage content.
  • Add and Customize Pages – add, change, or delete HTML pages or Web Part Pages, and edit the Web site using a Windows SharePoint Services-compatible editor.
  • Apply Themes and Borders – apply a theme or borders to the entire Web site.
  • Apply Style Sheets – apply a style sheet (.css file) to the Web site.
  • Create Groups – create a group of users that can be used anywhere within the site collection.
  • Browse Directories – enumerate files and folders in a Web site using SharePoint Designer and Web DAV (Distributed Authoring and Versioning) interfaces.
  • View Pages – view pages in a Web site.
  • Enumerate Permissions – enumerate permissions on the Web site, list, folder, document, or list item.
  • Browse User Information – view information about users of the Web site.
  • Manage Alerts – manage alerts for all users of the Web site.
  • Use Remote Interfaces – use SOAP, (Simple Object Access Protocol) Web DAV, or SharePoint Designer interfaces to access the Web site.
  • Use Client Integration Features – use features that launch client applications. Without this permission, users will have to work on documents locally and upload their changes.
  • Open – allows users to open a Web site, list, or folder in order to access items inside that container.
  • Edit Personal User Information – allows a user to change his or her own user information, such as adding a picture.

Personal Permissions:
  • Manage Personal Views – create, change, and delete personal views of lists.
  • Add/Remove Personal Web Parts – add or remove personal Web Parts on a Web Part Page.
  • Update Personal Web Parts – update Web Parts to display personalized information.

Armed with that information, you’re now in a position to try to create a new security group and give a person or a group of people a different level of access from what they had previously.

Sunday, 29 May 2011

Custom branding with SharePoint

Custom branding with SharePoint

For those of you working at new SharePoint 2007 sites, I have more of Darren Pritchard’s excellent beginner’s guides. This time he’s looking at custom branding.

There are a few different parts to custom branding a SharePoint Web application. You will need SharePoint Designer to create and change the pages. You will need to create a new master page and a CSS file to apply to the master page.

SharePoint Designer is a free application that is available from Microsoft at www.microsoft.com/downloads/en/details.aspx?familyid=baa3ad86-bfc1-4bd4-9812-d9e710d44f42&displaylang=en. SharePoint Designer allows you to open your SharePoint Web application to see and access all the component parts and elements of the application. You are able to navigate through the whole site, which will give you a better idea of how a SharePoint application is built. Be carefully not to change anything unless you know what it is – you could break the Web application if you remove or change the wrong thing!

SharePoint Designer also allows the pages and code to be edited, which is good news for someone new to SharePoint because everything is available within one location.

Let’s start with master pages. These are the templates that are applied to all pages on a SharePoint Web application. They are written in ASP.NET 2.0. When applying custom branding to a SharePoint Web application, this is where the majority of the development will be carried out.

CSS (Cascading Style Sheets) are used to style the master page (just like on most Web pages). Within a SharePoint Web application, there is a ‘core.css’ file, which can be found in the ‘_styles’ folder. You won’t be able to navigate here without using SharePoint Designer. This is used by all of the master pages that come by default in a Web application. This file should not be changed. It is best practice to create a bespoke .css file and use this to override the core.css. This means that you will not affect the default master page styles that are used by other pages.

Content PlaceHolders Controls are regions of content on a master page that are predefined but customizable within SharePoint. So, for example, the PlaceHolder is in bold, which is housed within an HTML table:
<!-- Search Start-->
  <table border="0" cellpadding=0 cellspacing=0 width="100%" class="customcss.class" >
    <tr>
      <td>

      <asp:ContentPlaceHolder id="PlaceHolderSearchArea" runat="server">
      <SharePoint:DelegateControl runat="server" ControlId="SmallSearchInputBox"/>
      </asp:ContentPlaceHolder>

      </td>
    </tr>
  </table>
<!-- Search End -->


This is an example of a table that will contain the search placeholder shown below:


Any images that are referenced from within the master page must be able to be viewed by all users. Otherwise, users will be asked to log-in every time they refresh the page if the don’t have permission to the library where the image is stored.

I would suggest creating a folder for your master page within the ‘http://Your App/Style%20Library/images’ and locating all of the images there. This will use the standard image locations from the master pages, but keep them separate so that they can be identified easily during future development or maintenance.

When you’re ready to import branding into a Web application, you need to use the following guidelines.

To import a master page:
1    In SharePoint Designer open up your Web application
2    Navigate to http://your site/_catalogs/masterpage
3    Click File
4    Click Import
5    Add your master page here.

To import an image:
1    In SharePoint Designer open up your Web application
2    Navigate to http://your site/Images
3    Click File
4    Click Import
5    Add your image here.

To import a CSS file:
1    In SharePoint Designer open up your Web application
2    Navigate to http://your site/_styles
3    Click File
4    Click Import
5    Add your CSS file here.

Good luck with your modifying your branding.

Friday, 15 April 2011

How to create a custom Web Part for SharePoint

I’ve been working recently with Darren Pritchard at a site that’s fairly new to SharePoint. They came up with a number of fairly basic ‘how to’ questions and Darren has put together some basic information for them. It seemed that if these new SharePoint users and had lots of questions, then so would many other sites. So it made sense to make this information available to the SharePoint community as a whole. This site was using SharePoint 2007.

The first thing to do when creating a custom Web Part is to set up a development environment. You need to create a development SharePoint 2007 (SP2007) server and give it a name. For SharePoint 2007 you need Visual Studio 2008 (VS2008). It’s worth noting that you can’t use Visual Studio 2010 (VS2010).

Install VS2008 onto your development SP2007 server. Next install the VS2008 SharePoint plug-in called “VSeWSSv13_AMD64_Build-433.exe”. This can be found at http://www.microsoft.com/downloads/en/details.aspx?FamilyID=fb9d4b85-da2a-432e-91fb-d505199c49f6. This plug-in adds the Web Part project to VS2008. Once this is in place, you’ll be able to actually create a custom Web Part.

Open VS2008, then click ‘File/New/Project’. Find the ‘Visual C#’ list and expand that. Next click ‘SharePoint’, and in the right-hand box click ‘Web Part’. Give your new project a name. The naming convention is og.wp.%Name%, where:
og = your organization (abbreviated, eg use gs if you’re company is called ‘Great Shoes’, etc.)
wp = Web Part
.%Name% = the name of the Web Part.

Make sure you tick ‘Create directory for solution’ – see Figure below.


Next you’ll see a trust level box. Make sure that it looks like this:



And click ‘OK’.

You can now go ahead and write your Web Part using Visual C#.

The next stage shouldn’t be missed – it’s testing your custom Web Part. You need to tell VS2008 where to deploy the Web Part. Click ‘Project’, ‘%PROJECT NAME% Properties’. On the tabs click ‘Debug’ and change the ‘Start browsers with URL’ box to point to your test site, eg http://yourdevelopmentserver:5003/. Click the cross in the right hand corner to save the changes.

To deploy your Web Part, click ‘Build’, ‘Deploy %PROJECT NAME%’. This will add the solution to SharePoint central admin and deploy the solution to your test site. You can add your Web Part to your test site in the same way that you would add any other Web Parts, and now you can test it.

It’s useful to know how to retract a test Web Part. Open your project in VS2008, click ‘Build’ and then ‘Retract Solution’. This will retract the solution from your test site and remove it from SharePoint central admin. You now need to manually remove the pointer from your test site. To do this open your test site and click ‘Site Actions/Site Settings/Modify All Site Settings’. Under Galleries click ‘Web Parts’ and delete your development Web Part.

Assuming that your Web Part worked as planned (finally!), you’ll want to deploy your solution into your live environment. Firstly, locate your project, eg ‘C:\Users\%USERNAME%\Documents\Visual Studio 2008\Projects’, then double-click on your new project, and locate the debug folder. Within this you should find %PROJECT NAME%.wsp. Finally copy this .wsp file onto your Live SharePoint Server.

I’ll share Darren’s full instructions for installing a solution another time.