Step by Step Guide for Installing MOSS 2007 on a VPC

April 26th, 2007 by mdp

I've found this guide from Tony Zink of the SharePoint Reporter Blog very handy for a walkthrough of installing MOSS 2007.  The guide gives you screen shots of every step along the way so that you can check your progress:

How to Create a MOSS 2007 VPC Image: The Whole 9 Yards

 

Using a SharePoint List as an Authentication Provider: Part 2

April 24th, 2007 by mdp

Willie Rust posted part two of his article about Using a SharePoint list as an Authentication Provider.

Check it out here:
http://www.willierust.com/Lists/Posts/Post.aspx?ID=7

If you missed the first article check it out here:
http://www.willierust.com/Lists/Posts/Post.aspx?ID=5

 

Forms Based Authentication using a SharePoint List Provider

April 20th, 2007 by mdp

My colleague Willie Rust wrote an excellent article on how to implement Forms Based Authentication using a SharePoint List Provider.  This allows you to manage your users using SharePoint's built in list interfaces and set permissions to this list inside of SharePoint.

 

Profile Properties Import/Export

April 13th, 2007 by mdp

If you need to import or export user profile properties from one server to another,   There is now a command line tool on codeplex.com called SharePoint 2007 Shared Services Provider User Profile Property Replicator.  It's a very handy utility so far, the syntax ends up being:

export user profiles to an output file
ProfilePropertyMgr.exe -url <url> -filename output.xml -export

import user profiles from an import file
ProfilePropertyMgr.exe -url <url> -filename input.xml -import

 Easy enough.  One thing that I would like to see in a future release is that it keeps the order of the properties.  Ordering the properties in the UI is a pain in the rear.

MCMS 2002 API vs MOSS API

April 13th, 2007 by mdp

As a MCMS 2002 developer it is sometimes hard to get used to the MOSS API for Publishing.  I have found that this Mapping MCMS 2002 APIs to SharePoint Server 2007 site to be very useful. I have supplied some example comparisons from the site below:

CmsHttpContext Properties

SPContext Properties
Channel PublishingWeb.GetPublishingWeb(SPContext.Current.Web);
Posting SPContext context = SPContext.Current; PublishingPage currentPage = PublishingPage.GetPublishingPage(context.ListItem);
RootChannel PublishingWeb.GetPublishingWeb(SPContext.Current.Web.Site.RootWeb);
User SPContext.Current.Web.CurrentUser

 

Getting Posting Values

In MCMS 2002:

Posting p = null;
//Code to get to the posting
AttachmentPlaceholder att = p.Placeholders["attachment1"] as
   AttachmentPlaceholder;
String attachmentText = att.AttachmentText;
HtmlPlaceholder html = p.Placeholders["html1"] as HtmlPlaceholder;
String htmlContents = html.Html;
ImagePlaceholder img = p.Placeholders["image1"] as ImagePlaceholder;
String ImageUrl = img.Href;

In SharePoint Server 2007:

PublishingPage p = null;
//Code to get to the page
LinkFieldValue linkfieldValue = p.ListItem["attachment1"]
   as LinkFieldValue;
String linkText = null;
if (null != linkfieldValue)
{
   linkText = linkfieldValue.Text;
}
String html = p.ListItem["html1"] as string;
ImageFieldValue imagefieldValue = p.ListItem["image1"] as ImageFieldValue;
String ImageUrl = null;
if (null != imagefieldValue)
{
   ImageUrl = imagefieldValue.ImageUrl;
}

Setting Postings Values

In MCMS 2002:

Posting p=null;
String text1 = "new attachment text";
String text2 = "new html";
String text3 = "new image href";
//Code to get to the posting
AttachmentPlaceholder att = p.Placeholders["attachment1"] as
   AttachmentPlaceholder;
att.AttachmentText = text1;
HtmlPlaceholder html = p.Placeholders["html1"] as HtmlPlaceholder;
html.Html = text2;
ImagePlaceholder img = p.Placeholders["image1"] as ImagePlaceholder;

img.Href = text3;
CmsHttpContext.Current.CommitAll();

In SharePoint Server 2007:

PublishingPage p = null;
String text1 = "new attachment text";
String text2 = "new html";
String text3 = "new image href";
//Code to get to the Page
LinkFieldValue linkfieldValue = p.ListItem["attachment1"] as
LinkFieldValue;
if (null != linkfieldValue)
{
   linkfieldValue = new LinkFieldValue();
}
linkfieldValue.Text = text1;
p.ListItem["html1"] = text2;

ImageFieldValue img = p.ListItem["image1"] as ImageFieldValue;
if (null != img)
{
   img = new ImageFieldValue();
}
img.ImageUrl = text3;
p.ListItem["image1"] = img;
p.Update();

"sgen.exe" exited with code 1

March 6th, 2007 by mdp

I was having trouble building a solution in VIsual Studio 2005 and I was getting the following error.

"sgen.exe" exited with code 1  

 I found that following the steps below fixed it:

Open up the project properties.
Open up the build tab.
Set "Generate Serialization Assembly" to "Off"

 

 

Inserting Data into a HyperLink Column in MOSS

February 26th, 2007 by mdp

If you need to insert data into a HyperLink column in a list, you can use the following code:

item["HyperLinkColumn"] = "http://www.google.com, Google";

Make sure you have a space after the comma.

 

FREE Colligo Reader for all versions of Sharepoint

February 26th, 2007 by mdp

Colligo Reader allows a user to access offline content for all versions of SharePoint which includes SharePoint Services (WSS 3.0 & 2.0) as well as MOSS 2007 and SharePoint Portal Server SPS 2003.  The install is rather small and requires no server modifications since it uses standard web services and site permissions to access content.

Download it here:

http://www.colligo.com/products/sharepoint/reader_home.asp

 

Uses of SPContext

February 26th, 2007 by mdp

Mirjam's blog lists some uses of SPContext.  Here are a few I grabbed from his post:

SPList currentList = SPContext.Current.List;
SPWeb currentSite = SPContext.Current.Web;
SPSite currentSiteCollection = SPContext.Current.Site;
SPWebApplication currentWebApplication = SPContext.Current.Site.WebApplication;
SPListItem item = (SPListItem)SPContext.Current.Item;
SPUser user = SPContext.Current.Web.CurrentUser;

He also explains the difference between the SPSiteDataQuery object and the SPQuery object.

Check it out here: /mirjam/archive/2007/02/23/19983.aspx

 

Creating a List with a Custom View in MOSS

February 26th, 2007 by mdp

The following code can be used to create a custom list in MOSS and apply a custom view to it:

	// create list
	web.Lists.Add(listName, "", SPListTemplateType.GenericList);
	list = web.Lists[listName];

	// Add your fields to the list
	list.Fields.Add("Field1", SPFieldType.Text, false);
	list.Fields.Add("Field2", SPFieldType.Text, false);

	// You can change the title of a field by accessing the SPField object
	SPField field1 = list.Fields["Field1"];
	field1.Title = "Title Of Field 1";
	field1.Update();

	// You have to use a specialized string collection to add fields to a view
	System.Collections.Specialized.StringCollection strCol = new System.Collections.Specialized.StringCollection();
	strCol = new System.Collections.Specialized.StringCollection();
	strCol.Add("Field1");
	strCol.Add("Field2");

	// You can use a standard query here to only return certain data
	string query = string.Empty;
	query = "";
	SPView view = null;
	view = list.Views.Add("Items Sorted By Field1", strCol, query, 20, true, false);

	list.Update();