October 2008 Entries



I saw a post on the MSDN threads, where a question was asked about a possible workflow to move a document from one document library to a document library in another site collection.

Good question, but let's do this with less than a workflow.

Lets take two document libraries, one on http://server1/SiteCollection1/Docs and another one on http://server1/SiteCollection2/Docs

Now, through the UI, we can browse to SC1 docs, Clcik on settings, advanced, and set a URL


Produces this option:

And it will copy your item to the desired location!

Now, nothing can be complete without the option to do this in code!

//Get reference to "Documents"
SPList sourceList = currentWeb.Lists["Docs"];
string strSendToURL = destinationWebUrl;
//In our case, "http://server1/SiteCollection2/Docs

//Set the url
sourceList.SendToLocationUrl = strSendToURL
//Setup the visual link name how you like
sourceList.SendToLocationName = "Move to Docs 2"
sourceList.Update();
Enjoy!
I was working on a project to customize a Meeting Workspace, here are some details.
· Feature stapler to activate a feature receiver when a Meeting site is created
· Feature receiver to do a bunch of things to customize a newly created site
· Create some lists
· Modify lists to be Series
· Add custom content types
· Associate these content types with the list

The main point I am trying to make here, is the series list
You want to achieve this in code: Share List Items Across All Meetings (Series Items) Now let’s go look at some code. First we are going to create a list, in case it exists, we will have the SPList object either way, I do not like exceptions, but in this case I didn’t feel like looping through the site’s list collection and matching a name…

SPList MinutesList;
try
{
MinutesList = m_CurrentWeb.Lists["TaskList"];
}
catch (ArgumentException ArgEx)
{
Guid ListId = m_CurrentWeb.Lists.Add("TaskList", "Used to store tasks for a meeting.", SPListTemplateType.Tasks);
MinutesList = m_CurrentWeb.Lists[ListId];
}

Now that we have our SPList, make some changes to it:
//Turn on email on assigned
MinutesList.EnableAssignToEmail = true;
//Turn off folder creation
MinutesList.EnableFolderCreation = false;
//Turn on Content Types
MinutesList.ContentTypesEnabled = true;
//Make the list a series list
MinutesList.MultipleDataList = false;
MinutesList.Update();

The important part of this post is in bold, MultipleDataList set to false gives you a series list. (Data that is shared throughout a meeting series) You can see the MS documentation here. But this is like a lot of MS documentation these days, not very good.

Cheers.
So I built a new VM a couple of weeks ago on win2k8 and installed WSS, SP1, MOSS, SP1, Project server, all the tools I can think of...

Going to deploy my common library, and I get this...

"The timer job for this operation has been created, but it will fail because the administrative service for this server is not enabled. If the timer job is scheduled to
run at a later time, you can run the jobs all at once using stsadm.exe -o execadmsvcjobs. To avoid this problem in the future,
enable the Windows SharePoint Services administrative service, or run your operation through the STSADM.exe command line utility."

I ran into this a little while ago, and just went on my way, but I thought why not post it so that when I have this happen when I am tired, I know I can check here to find out what I did to fix it. Well really it is just as the message says...



And... just start the service. (In the case of a dev box, I will just set it to automatic, so that it is always running for me.)

Cheers.
So I am working on a WCF application to help administer SharePoint farms, and well... It is REALLY cool.

So far, I have a fat client in WPF that sends messages to a Central point (Central Admin server) and it passes these tasks/messages around the farm for you. The basics, rapid prototyping, we have a bunch of services in place, and we wanted to make this easy to setup. So, we went on and created setup projects to install the services, reading port, service username etc. from the setup project, but then wait, what if you want to change them later? So we dropped data into the registry, and all was good. But now, we talked about a GUI way to configure ports, protocols, etc. and well here we are, who wants to send your SharePoint admins/developers into the registry?

So we decided and I am setting up a simple windows application to save data to a config file read by the service when it starts. Now, what kind of files to use? I really am hating XML these days, files are SOOO bloated, and since I know how I plan to save the data and how I plan to read the data, any format will work. In fact, I am going to base64 it just to make sure people do not get "savy" and start changing values in a text file, when there is in fact an admin (gui) tool for it.

Now how to make sure your changes are made and not have to wait for a reboot to see the changes? Well we need to stop the service and have it start up and read the values, or we can check the status of the service, make sure it gets stopped, and THEN save, and start the service? Yes.

I found a control lying around called ServiceController! Perfect. Just need to know the name of the service, and you can start/stop/reset a service.

Well, that's about it, back to wrapping this thing up. After I create an EXE for the configuration utility, I will include it in the setup projects and place it in the app folder, and we are back to writing more messages for our new WCF application!
This is a great tool to aide in information gathering and administration in centralized place.

If you develop for SharePoint 2007, or are an administrator and have access to a console of a SharePoint server, you NEED to take a look at this tool.

http://www.sharepointblogs.com/keutmann/archive/2006/11/03/sharepoint-manager-2007-new-version.aspx

Give it a shot.