Spiga

SharePoint User Permissions

Personal Permissions

Manage Personal Views
Create, change, and delete personal views of lists.

Add/Remove Private Web Parts
Add or remove private web parts on a web part page.

Update Personal Web Parts
Update web parts to display personalized information.
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 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
Grant the ability to perform all administration tasks for the web site as well as
manage content and permissions.

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 WebDAV interfaces.

Use Self-Service Site Creation
Create a web site using self-service site creation.

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, WebDAV, 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
Allow users to open a web site, list, or folder in order to access items inside
that container.

Edit Personal User Information
Allow a user to change his or her own user information, such as adding a picture.

Using ASP Code Behind in Sharepoint 3.0

A useful article on Application pages

http://www.andrewconnell.com/blog/articles/UsingCodeBehindFilesInSharePointSites.aspx

Document Conversion - Content Type Configuration


I did this one day and forgot where I did it the next. So after a bunch of fiddling around and retracing my steps I'm putting this here as a reminder of how and where this is.

So assuming you have document conversion set up. You'll need to go to the site setting of the site you want to configure.


Select Content Types



In my case I wanted to manage documents so click on the Source Column of the Document Site Content Type Row in the Site Content Type Gallery.



and click on Document.



It might be that you can't see the option I am talking about here. You might need to turn on publishing at the site collection level of your site.

Now the options start making more sense so...Click Manage document conversion for this content type.



In the Allowed converters for this content type: section click the Configure... link of the document converter you are interested in configuring.



Voila...this is configuration screen.


Theme caching

When editing a theme you might find that the changes you make don't stick.

change the theme to one that is not your theme.

reset IIS (iisreset) or recycle the app pool that you site is running under.

then change the theme back to reveal your latest edits.

hooray!

How to activate Document Conversion

A nice feature in sharepoint for users that like to use word as a content editor. They can upload a word docx document and convert it to a web page in sharepoint.

http://www.sharepointblogs.com/ajp/archive/2008/04/06/document-conversion-turn-your-docx-to-a-html-page.aspx

Solves the problem of a hung Load balancer

http://support.microsoft.com/kb/941212

Step 1: Stop the Document Conversions Launcher Service

1.Click Start, click Run, type cmd, and then click OK.
2.At the command prompt, type the following command:
cd \Program Files\Common Files\microsoft shared\web server extensions\12\bin
3.At the command prompt, type the following command to create a .txt file that contains the names of all the services, and then press ENTER:
stsadm -o enumservices > Drive\serv.txt
Note In this command, Drive is the letter of the drive in which you want to save the .txt file.
4.At the command prompt, type the following command, and then press ENTER:
stsadm -o provisionservice -action stop -servicetype ServiceTypeName -servicename ServiceName
Note In this command, ServiceTypeName is the name of the servicetype that is contained in the serv.txt file. Additionally, ServiceName is the servicename that is contained in the serv.txt file.
5.At the command line, type the following to reset Internet Information Services (IIS), and then press ENTER:
iisreset

Step 2: Start the Document Conversions Launcher Service

1.Click Start, click Run, type cmd, and then click OK.
2.At the command prompt, type the following command:
cd \Program Files\Common Files\microsoft shared\web server extensions\12\bin
3.At the command prompt, type the following command, and then press ENTER:
stsadm -o provisionservice -action start -servicetype ServiceTypeName -servicename ServiceName
Note In this command, ServiceTypeName is the name of the servicetype that is contained in the serv.txt file. Additionally, ServiceName is the servicename that is contained in the serv.txt file.
4.At the command line, type the following to reset Internet Information Services (IIS), and then press ENTER:
iisreset

Themes a glitch in naming

Just a warning on themes. If you get an error when applying your theme that looks like this

A theme with the name MyTheme 1011? and version already exists on the server.
Then you have either forgotten to edit the INF file in your theme or your theme name has pattern matched another theme in your theme directory. In my case I copied verdant and named it verdantx this gave me the error i mentioned above because it clashed with the original theme...maybe I should use GUIDS for the theme names to fix this.

Post Build Events

I posted this on my site...mostly to remind me. Handy bit of functionality

http://sites.google.com/site/thenakedpirateweb/Home/vsnet-build-events

Don't want to GAC log4net.dll

In this example I'll use log4net

I managed to get logging working by dropping the log4net release dll in the _app_bin directory found on my dev system in C:\Inetpub\wwwroot\wss\VirtualDirectories\8081\

The 8081 part is the same as the port I have serving up the sites I am currently playing with.

This is nice to know in a dev environment as you might not want to go to the trouble of GACing (is that a verb?) everything you deliver in you solution.

OK that's fine how do I use it?

My working example extends my previous post on application pages.
Add this code to your web.config (which should be empty at the moment)


<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
</configSections>

<log4net debug="true">
<root>
<level value="ERROR" />
<!-- priority value can be set to ALL|INFO|WARN|ERROR -->
<priority value="ALL" />
<appender-ref ref="AdoNetAppender" />
</root>

<!-- Define some output appenders -->
<appender name="AdoNetAppender" type="log4net.Appender.AdoNetAppender">
<bufferSize value="1" />
<connectionType value="System.Data.SqlClient.SqlConnection, System.Data, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<connectionString value="data source=VSMOSSCOMBO;initial catalog=WSS_Log;integrated security=true;" />
<commandText value="INSERT INTO dbo.ExceptionLog ([Date],[Thread],[Level],[Logger],[Message],[Exception],[ApplicationUser]) VALUES (@log_date, @thread, @log_level, @logger, @message, @exception, @user)" />
<parameter>
<parameterName value="@user" />
<dbType value="string" />
<size value="255" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%X{user}" />
</layout>
</parameter>
<parameter>
<parameterName value="@log_date" />
<dbType value="DateTime" />
<layout type="log4net.Layout.RawTimeStampLayout" />
</parameter>
<parameter>
<parameterName value="@thread" />
<dbType value="String" />
<size value="255" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%thread" />
</layout>
</parameter>
<parameter>
<parameterName value="@log_level" />
<dbType value="String" />
<size value="50" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%level" />
</layout>
</parameter>
<parameter>
<parameterName value="@logger" />
<dbType value="String" />
<size value="255" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%logger" />
</layout>
</parameter>
<parameter>
<parameterName value="@message" />
<dbType value="String" />
<size value="4000" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%message" />
</layout>
</parameter>
<parameter>
<parameterName value="@exception" />
<dbType value="String" />
<size value="2000" />
<layout type="log4net.Layout.ExceptionLayout" />
</parameter>
</appender>
</log4net>
</configuration>


This web.config points to a database called WSS_Log with a table called ExceptionLog. Here is the Create Script for the table.


CREATE TABLE [dbo].[ExceptionLog](
[ExceptionLogKey] [int] IDENTITY(1,1) NOT NULL,
[Guid] [uniqueidentifier] NULL,
[ApplicationUser] [nvarchar](255) NULL,
[Date] [datetime] NULL,
[Thread] [nvarchar](255) NULL,
[Level] [nvarchar](50) NULL,
[Logger] [nvarchar](255) NULL,
[Message] [nvarchar](4000) NULL,
[Exception] [nvarchar](2000) NULL,
PRIMARY KEY CLUSTERED
(
[ExceptionLogKey] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]


Add this to your AssemblyInfo.cs


[assembly: log4net.Config.XmlConfigurator(ConfigFile = "Web.config", Watch = true)]

Now you can use the Log but for completeness make your Default.aspx.cs look like this.


using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;
using log4net;
using log4net.Core;

namespace MOSS.Web.Application.Basic
{

[CLSCompliant(false)]
public class Default : LayoutsPageBase
{
private static readonly ILog log = LogManager.GetLogger("Logger");

// add control fields to match controls tags on .aspx page
protected Label lblSiteTitle;
protected Label lblSiteID;

protected override void OnLoad(EventArgs e)
{
log.Debug("OnLoad");

// get current site and web
SPSite siteCollection = this.Site;
SPWeb site = this.Web;

// program against controls on .aspx page
lblSiteTitle.Text = site.Title;
lblSiteID.Text = site.ID.ToString().ToUpper();
}
}
}

Application Pages

The Awesome power of Application Pages

A useful link http://msdn.microsoft.com/en-us/library/bb418732.aspx

In VS.Net 2005 on your MOSS Server Development Environment create an empty Sharepoint Project. (I called mine MOSS.Web.Application)
Add a reference to Microsoft.SharePoint (Windows® SharePoint® Services) v2.0.50727
In my environment its at C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\ISAPI\Microsoft.SharePoint.dll

(If you can't work out which one to choose add a webpart to the solution then delete the Webpart bits that were just added)


Add a directory named Templates to the project root
Add a directory named LAYOUTS to the Templates Directory you just made
Add a directory named {Your Application Page Directory} to LAYOUTS (I made one called Basic)
Under {Your Application Page Directory} add a file called default.aspx with this code in it.




<%@ Assembly Name="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"%>
<%@ Assembly Name="MOSS.Web.Application, Version=1.0.0.0, Culture=neutral, PublicKeyToken={PUBLIC KEY TOKEN}"%>

<%@ Page Language="C#" MasterPageFile="~/_layouts/application.master"
Inherits="MOSS.Web.Application.Basic.Default" %>



<asp:Content ID="Main" runat="server" contentplaceholderid="PlaceHolderMain" >
Site Title: <asp:Label ID="lblSiteTitle" runat="server" />
<br/>
Site ID: <asp:Label ID="lblSiteID" runat="server" />
</asp:Content>

<asp:Content ID="PageTitle" runat="server"
contentplaceholderid="PlaceHolderPageTitle" >
Hello World
</asp:Content>

<asp:Content ID="PageTitleInTitleArea" runat="server"
contentplaceholderid="PlaceHolderPageTitleInTitleArea" >
The Quintessential 'Hello World' of Application Page
</asp:Content>


Under {Your Application Page Directory} add a file called default.aspx.cs with this code in it.


using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;

namespace MOSS.Web.Application.Basic
{

[CLSCompliant(false)]
public class Default : LayoutsPageBase
{

// add control fields to match controls tags on .aspx page
protected Label lblSiteTitle;
protected Label lblSiteID;

protected override void OnLoad(EventArgs e)
{

// get current site and web
SPSite siteCollection = this.Site;
SPWeb site = this.Web;

// program against controls on .aspx page
lblSiteTitle.Text = site.Title;
lblSiteID.Text = site.ID.ToString().ToUpper();
}
}
}


Go to your project's WSP View and open manifest.xml making sure this code is in there




<?xml version="1.0" encoding="utf-8"?>
<Solution SolutionId="ce340c94-3b75-4abd-9a2d-537b8db6ada5" xmlns="http://schemas.microsoft.com/sharepoint/">
<Assemblies>
<Assembly Location="MOSS.Web.Application.dll" DeploymentTarget="GlobalAssemblyCache" />
</Assemblies>
<TemplateFiles>
<TemplateFile Location="LAYOUTS\Basic\default.aspx" />
<TemplateFile Location="LAYOUTS\Basic\Default.aspx.cs" />
<TemplateFile Location="LAYOUTS\Basic\Web.config" />
</TemplateFiles>
</Solution>


In the Project's Properties on the Debug Page put the url to the MOSS Site you wish to deploy to.

Once you have done that go to the Build menu and Deploy your Project

You will find it at {Your Sharepoint url}/_layouts/{Folder}/{Page}

How to get the PublicKeyToken of an Assembly

Can't find the PublicKeyToken of an Assembly?

Here is how.

Open the Visual Studio Command Prompt
type sn -T {target path} where {target path} is the path to the assembly in question.
You will get the PublicKeyToken and be happy again