Posted by (JavaScript must be enabled to view this email address) on Wed 11 Mar 2009

After installing Office 2007 Project Server on our MOSS 2007 box we were unable to provision the project access website as it was failing with the error message:

“The Project Application Service doesn’t exist or is stopped. Start the Project Application Service.”

To resolve it we had to first of all:

stsadm -o provisionservice -action start -servicetype “Microsoft.Office.Project.Server.Administration.ProjectApplicationService, Microsoft.Office.Project.Server.Administration, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71E9BCE111E9429C” -servicename ProjectApplicationService

Then provide the MOSS SSP Account with temporary administrative access to the DB server to allow it to generate the required dbs.



Posted by (JavaScript must be enabled to view this email address) on Mon 09 Mar 2009

Occasionally you will find that your user account doesn’t have a default database associated with it, this will stop you logging into SQL using Windows Authentication regardless of being a local administrator.

To be able to log in do the following:

1. Create a local user (as you have administrative access this is fine)
2. Add the user to local administrators and to the SQL Server Users group something like this (SQLServer2005MSSQLUser$MACHINENAME$INSTANCENAME)
3. Restart the SQL Server
4. Log into the laptop as the new local user
5. Run SQL Server
6. Go to security and right click on the user account which does not have access to SQL Server and select properties
7. Set the default database as master
8. Set the user role as required
9. Ensure that the user has access to the correct databases
10. Click ok
11. Log out of the pc
12. Log in as the original user.

You will now have access to log into the SQL Server.



Posted by (JavaScript must be enabled to view this email address) on Thu 29 Jan 2009

I’d recently written a SharePoint custom navigation object as the default functionality didn’t meet the customers needs. It tested out perfectly, only displaying pages which the user was able to see and which were also published.

When deployed on the live server though, no matter what I did, it simply wasn’t picking up the fact that some pages had been published, others had expired. It was displaying all content (apart from the hidden pages) in the publishing site.

What was going on

For too long I focused on the way the dates were being handled by my control…but surely the PortalSiteNavigation provider should take care of this?!?!?? I even went so far as to load the corresponding page item for each SiteMapNode in the SiteMapNodes collection then checking the PublishingStartDate and PublishingExpirationDate (Scheduled Start Date and Scheduled End Date) - Imagine the hit on performance when I did that!

After a lot of hair ripping, and swearing I found the issue.

Stsadm extensions had been installed on the server- I had used them a number of times to publish content en-masse for the customer - but it never twigged with me that this might be the root cause of all my issues.

A normally super helpful command gl-publishitems was the culprit. Gary Lapointes code has helped me out a number of times, this is by no means a slight against his code - just an unforeseen issue arising from it.

Each time the gl-publishitems code was run against the WebApplication it was republishing the “expired” content. SharePoint doesn’t actually use the dates at runtime to decide whether content should be displayed or hidden, it uses the dates as part of the Scheduled Unpublish and Scheduled Publish timer jobs to set the publishing status to published or draft.

The second issue was that not only was gl-publishitems republishing my content, but when the ScheduledUnpublish job would run, it would unpublish the content, however there were previous versions available in the system - and again SharePoint only rolls back the current version not all versions when the Scheduled Unpublish job runs.

So how did I resolve it?

By programmatically getting all versions of the “expired” document and setting them to Draft status using the File.Unpublish Command

I’ve included code samples in both C# and VB.Net here:

VB.Net

  1. if (Convert.ToDateTime(Actual) < DateTime.Now) then
  2. rWeb.AllowUnsafeUpdates = true
  3. lItem.ModerationInformation.Status = SPModerationStatusType.Draft ' set the item to draft
  4. lItem.File.UnPublish("System Unpublished") 'unpublish the file
  5.  
  6. 'for each previous version of the file
  7. Dim objVersionColl As SPListItemVersionCollection = lItem.Versions
  8. If objVersionColl.Count > 1 Then
  9. Previous = "resetting previous versions"
  10. 'Navigate to each version of the ListItem
  11. For Each objVersion As SPListItemVersion In objVersionColl
  12. Dim objLstItm As SPListItem = objVersion.ListItem
  13. objLstItm.ModerationInformation.Status = SPModerationStatusType.Draft ' set the item to draft
  14. objLstItm.File.UnPublish("System Unpublished") 'unpublish the file with comment
  15. objLstItm.SystemUpdate(false) 'updates the list item without incrementing the version
  16. Next 'Next objVersion
  17. End If 'End of objVersionColl.Count if
  18. lItem.SystemUpdate(false)
  19. end if

C#

  1. if ((Convert.ToDateTime(Actual) < DateTime.Now)) {
  2. rWeb.AllowUnsafeUpdates = true;
  3. lItem.ModerationInformation.Status = SPModerationStatusType.Draft;
  4. // set the item to draft
  5. lItem.File.UnPublish("System Unpublished");
  6. //unpublish the file
  7.  
  8. //for each previous version of the file
  9. SPListItemVersionCollection objVersionColl = lItem.Versions;
  10. if (objVersionColl.Count > 1) {
  11. Previous = "resetting previous versions";
  12. //Navigate to each version of the ListItem
  13. foreach (SPListItemVersion objVersion in objVersionColl) {
  14. SPListItem objLstItm = objVersion.ListItem;
  15. objLstItm.ModerationInformation.Status = SPModerationStatusType.Draft;
  16. // set the item to draft
  17. objLstItm.File.UnPublish("System Unpublished");
  18. //unpublish the file with comment
  19. objLstItm.SystemUpdate(false);
  20. //updates the list item without incrementing the version
  21. }
  22. //Next objVersion
  23. }
  24. //End of objVersionColl.Count if
  25. lItem.SystemUpdate(false);
  26. }

A word of warning

The code I posted here does not differentiate between major and minor versions. You can only UnPublish Major versions so you will need to handle that yourself.

I used SystemUpdate(false) instead of Update as it doesn’t increment the version count - I would recommend you use File.Update instead.

REMEMBER - ALWAYS TAKE A BACKUP!



Page 6 of 9 pages « First  <  4 5 6 7 8 >  Last »

About our Blog

Brantas Limited specialise in Dynamics CRM, SharePoint and System Integration using the Microsoft Platform. We are all experienced developers in various fields with our own specialities complementing those of our team.

We have been working with SharePoint since 2003, including Installation and Administration, Migration, Development and Support.

RSS Feed