by Heathesh
28. January 2010 01:16
In order to do this, you will need remote desktop access (or similar) to the relevant SharePoint server. You will also need an administrator account, with which you will need to log onto the server with.
So to begin, the first thing you need to do is to create a little console app that will accomplish the required task. Next, you need to copy the Microsoft.SharePoint dll from the server locally, and add a reference to your project to it. You should find the DLL on your SharePoint server here:
C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\ISAPI
Next, add the relevant using to your code:
using Microsoft.SharePoint;
Now you can simply add the following code to your Main method:
static void Main(string[] args)
{
try
{
//we need the privileges to execute the moveto command
SPSecurity.RunWithElevatedPrivileges(delegate()
{
//connect to the site collection
using (SPSite mySite = new SPSite("http://server"))
{
//open the relevant site
using (SPWeb myWeb = mySite.OpenWeb("TestSite"))
{
//loop through the lists
foreach (SPList list in myWeb.Lists)
{
//when we find the correct list, change the name
if (list.RootFolder.Name == "TestList")
{
//move the root folder
list.RootFolder.MoveTo(list.RootFolder.Url.Replace("TestList", "TestList_New"));
}
}
}
}
});
Console.WriteLine("Done");
}
catch (Exception ex)
{
Console.WriteLine("Error: {0}", ex);
}
Console.ReadLine();
}
And lastly, compile the application, copy it over to your SharePoint server, and run it...
by Heathesh
11. January 2010 20:02
After a recent SharePoint server migration, we were unable to link our projects to their workspaces. The error message we got when trying to link the project to the workspace was "Given project workspace has not been configured with a valid Project Server template". We knew the template used was correct, and there should have not been any changes to it.
After some digging around we realised that the "Project Workspace Collaboration Lists" feature on the workspaces was not enabled. However, when we tried to enable it we would get the error "There can only be one instance of this list type in a web. An instance already exists."
Side Note: To activate the "Project Workspace Collaboration Lists" feature go onto the workspace site, and select "Site Actions" -> "Site Settings" -> "Site features" (under "Site Administration") -> find "Project Workspace Collaboration Lists" and click activate.
In order to fix the problem with the "Project Workspace Collaboration Lists" feature we had to check the SharePoint log files ("C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\LOGS") to see what exactly the error was. We came across the following error message: "The element of type 'ListInstance' for feature 'PWSIssues' (id: 00000000-0000-0000-0000-000000000000) threw an exception during activation: There can only be one instance of this list type in a web. An instance already exists".
The only way we could enable that feature was to do it forcefully, so we logged onto our SharePoint box and ran the following command from the command line in the "C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN" folder:
stsadm -o activatefeature -name "PWSIssues" -url "http://sharepoint/sites/my workspace" -force
We then tried to activate the "Project Workspace Collaboration Lists" feature again, got a similar error, checked the log file and this time it said: "The element of type 'ListInstance' for feature 'PWSRisks' (id: 00000000-0000-0000-0000-000000000000) threw an exception during activation: There can only be one instance of this list type in a web. An instance already exists".
So again, we forcefully activated the feature:
stsadm -o activatefeature -name "PWSRisks" -url "http://sharepoint/sites/my workspace" -force
We then tried to activate the "Project Workspace Collaboration Lists" feature again, and voila it worked! So we then tried to link the project to the workspace, and voila, that worked too! Relief... :-)