Busy building a timer job for a project I’m working on.

Some research led me to this cool little Visual Studio add in template  from Scot Hillier which you can download from here - http://visualstudiogallery.msdn.microsoft.com/ab2b2d63-de37-4f63-b4b0-442f80b59b00

Very easy to get started and Scot has written a great SBS to assist with your first timer job, which you can follow here:
http://www.shillier.com/archive/2011/04/13/sharepoint-2010-timer-job-item.aspx

Happy coding!!

So, I was challenged to complete a DB restore from the free SQL 2008 Express Database to the SQL 2008 Standard on a standalone SharePoint 2010 Farm.

Somehow, the content database had grown to 22GB, which was not normal, as SQL Express has a limit of 4GB. Not realising the size of the content DB, I detached it in the hope to reattach it to the new SQL 2008 Standard instance.
I began the upgrade process on the new instance, by restoring the content DB. I then attempted to use Power Shell to restore the site, but I was presented with another one of those easy to fix errors:

Wow, not something I had expected. Anyway, I found some info on the net that suggested you could get around this error using STSADM, but that also failed with the same error:

So, checked the versions of my SharePoint Farm, and compared the older version. Both appeared to be the same.
After some more research, I found an article that suggested an update could be the root cause, and that a newer CU (August 2011) should be applied.
I was not keen on applying any CUs at this stage, so I needed to find another way to do this. I tried to reattach the content DB back to the SQL 2008 Express instance, but that did not work as the db was too large.

So I started fiddling around with attaching another content DB to the SQL 2008 Standard instance.

Got that to work, and I’d now added the content DB containing the site collections from the SQL 2008 Express instance.

You can see that the old instance has 3 site collections:

I then was interested to see if I could possibly move the site collections from the Site Content And Structure on the Site Admin menu.
No joy there, as I could actually see the content in the SQL Express content DB. Then I stumbled on a Power Shell command that allows one to move site collections from one content DB to another.

This command took a while to run considering the size of the DB was 22GB.

It completed successfully, and when I checked again, it now showed that the 3 site collections had infact been moved:

Once this PowerShell command had completed, and I was able to see that the site collections had been moved, I tested the URL of the site collection I wanted to restore.

Voila! It worked. There were some other smaller issues, which were related to configuration, like some of the documents did not open in Excel, which was because the Excel Service Application was not created.

Hope that this post will help some one else who might be battling to get around an error that complains about a backup file that should be restored to a server with a version later than the current version.

Cheers for now,

D

Had quiet a tough issue to resolve today. It had to do with documents that were added to a library automatically being locked.

No user or admin account could edit, delete, override checkout or checkin. The document could not be managed from Explorer view either.
I searched my fingers blue. Some theories pointed me to Network load balancers, while other mentioned the temporary internet files being the culprit. I’m sure all of these are valid solutions in some instances, but, they did not work in our environtment.

I needed to find an answer. So I started by checking the settings of the Document Library. I found that it been configured to use record centre settings.
After a little more research, it appeared that this was exactly the cause of the problem. It made sense, as the configuration was done is such a way to block editing and deleting of the documents in the library.

There was an easy way to fix this, below are the steps I tool:

Go to Central Admin, click on Record Declaration Settings

Next, change the setting under Record Restrictions from Block Edit and Delete to No Addtional Restrictions

Then go to the library in question, and edit the Record Declaration Settings found under Permissions and Management

Uncheck the box next to “Automatically declare items as records when they are added to this list.

so that the site collection default settings will be used

Now when you add items to the library, they will not automatically be declared as records and will not have a lock on the item

Hope this helps someone figure out their problem.
Please leave comments if you have any.

 

If you recieve this error on your SharePoint Farm:

Make sure to check your Network Load Balancers.

We had added a Web Front End to the Farm, and right after that, the search functions broke.

We spent a couple of days on finding a fix for this and eventually removed the WFE from the NLB.
After adding the servers back, out of the NLB, the search works just fine.

Seemed to be caused by a conflict in the IP address, alhtough I’m not 100% certain if this is the root cause.
I have a feeling it could also have been resolved with Alternate Access Mappings.

 

The other day, I was trouble shooting a search issue, and while trying to check out the settings on the SSP admin site in Central Admin, I could not navigate to the SSP Admin site at all.

I simply got a blank IE page:

So after some digging I thought I should check the services running on my farm:

To do that, I ran the following STSADM.exe command:
C:\Program Files\Common Files\microsoft shared\Web Server Extensions\12\BIN>stsa
dm -o enumservices

This gives you a listing of resembling the following (bold is the line that I need to be concerned about):

<Services>
<Service>
    <Type>Microsoft.SharePoint.Administration.SPWebService, Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c</Type>
    <Name />
    <DisplayName>Windows SharePoint Services Web Application</DisplayName>
    <Status>Disabled</Status>
  </Service>
<Service>
<Type>Microsoft.SharePoint.Administration.SPWebService, Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c</Type>
<Name>WSS_Administration</Name>
<DisplayName>Central Administration</DisplayName>
<Status>Online</Status>
</Service>
<Service>
<Type>Microsoft.Office.Server.Administration.OfficeServerService, Microsoft.Office.Server, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c</Type>
<Name />
<DisplayName>SSP Job Control Service</DisplayName>
<Status>Online</Status>
</Service>
<Service>
<Type>Microsoft.SharePoint.Administration.SPAdministrationService, Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c</Type>
<Name>SPAdmin</Name>
<DisplayName>Windows SharePoint Services Administration</DisplayName>
<Status />
</Service>
<Service>
<Type>Microsoft.SharePoint.Administration.SPDatabaseService, Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c</Type>
<Name />
<DisplayName>Windows SharePoint Services Database</DisplayName>
<Status>Online</Status>
</Service>
<Service>
<Type>Microsoft.Office.Server.Administration.AnalyticsService, Microsoft.Office.Server, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c</Type>
<Name />
<DisplayName>Office SharePoint Usage Analytics Service</DisplayName>
<Status>Online</Status>
</Service>
<Service>
<Type>Microsoft.SharePoint.Portal.Administration.PortalService, Microsoft.SharePoint.Portal, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c</Type>
<Name />
<DisplayName>Portal Service</DisplayName>
<Status>Online</Status>
</Service>
<Service>
<Type>Microsoft.Office.Server.Administration.JobSchedulerService, Microsoft.Office.Server, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c</Type>
<Name />
<DisplayName>Shared Services Timer</DisplayName>
<Status>Online</Status>
</Service>
<Service>
<Type>Microsoft.Office.Server.Search.Administration.SearchService, Microsoft.Office.Server.Search, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c</Type>
<Name>OSearch</Name>
<DisplayName>Office SharePoint Server Search</DisplayName>
<Status>Online</Status>
</Service>
<Service>
<Type>Microsoft.Office.Server.Search.Administration.SearchService, Microsoft.Office.Server.Search, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c</Type>
<Name>OSearch</Name>
<DisplayName>Office SharePoint Server Search</DisplayName>
<Status>Online</Status>
</Service>
<Service>
<Type>Microsoft.SharePoint.Administration.SPTimerService, Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c</Type>    <Name>SPTimerV3</Name>
<DisplayName>Windows SharePoint Services Timer</DisplayName>
<Status />
</Service>
<Service>
<Type>Microsoft.Office.Excel.Server.ExcelServerSharedWebService, Microsoft.Office.Excel.Server, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c</Type>
<Name />
<DisplayName>Excel Calculation Services</DisplayName>
<Status>Online</Status>
</Service>
<Service>
<Type>Microsoft.Office.Server.Search.Administration.SearchAdminSharedWebService, Microsoft.Office.Server.Search, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c</Type>
<Name>SearchAdminSharedWebService</Name>
<DisplayName>Office SharePoint Server Search Admin Web Service</DisplayName>
<Status>Online</Status>
</Service>
</Services>

So based on this listing, I can see that the Windows SharePoint Services Web Application is Disabled. I now need to enable this web service, and then my SSP Admin site should be back up and functioning 100%.

To do that I run the following command in STSADM.exe:
stsadm -o provisionservice -action start -servicetype SPWebService

For more information on the provisionservice command, check out TechNet:
http://technet.microsoft.com/en-us/library/cc262031(office.12).aspx

Once this command has been run, I need to reset IIS.

I can now run the enumservices command again, and I should get a result showing that the Windows SharePoint Services Web Application is now Enabled.

My Central Admin SSP Admin site should now be up and functioning 100% again:

Recently a collegue and I ran in to an unexpected error at a client. It was quite tough to diagnose, as the initial error pointed us to a permissions issue.

However, after some intense research, we found information that led us to believe it was a corrupt cache file.
Below are the steps to repair the corrupt cache :

  1. Log into the SharePoint Server experiencing the corrupt cache.
  2. Stop the SharePoint 2010 Timer Service (OWSTIMER)
  3. Navigate to ‘C:\ProgramData\Microsoft\SharePoint\Config\{GUID}
    There may be more than one {GUID} folder.
  4. One of these {GUID} folders will contain a cache.ini file, and a number of .XML files.
    Make a backup of these files. WARNING, DO NOT DELETE THE Cache.ini FILE. It will break your Farm!
  5. Now, delete all the .XML files.
  6. Then open the Cache.ini file, and edit the value in the file to 1. Save and close the file.
  7. Now, start the SharePoint 2010 Timer Service.
    You will see the new .XML files being built.
  8. If you open the Cache.ini, you will see that the number you saved has been replaced.
  9. You should now be able to run the PSCONFIG successfully and complete the configuration of your farm.

There are various causes for the Cache to become corrupted. Researching this problem, has shown that any of the following causes can be linked:

  • When the cached data is out of sync with the configuration database, timer jobs might start failing. This is usually when the content of the file system cache on the front-end servers are newer that the contents of the configuration db.
  • The Timer job service on the SharePoint servers stopped of failed unexpectedly.
  • Network connectivity (intermittent connections)
  • Connection Pools, Thread Pools, resource contention & database locking.

Here are some links to additional resources where we found the same or similar information:
http://sharepointreporter.wordpress.com/tag/psconfig-errors
http://blogs.msdn.com/b/josrod/archive/2007/12/12/clear-the-sharepoint-configuration-cache-for-timer-job-and-psconfig-errors.aspx
http://blogs.msdn.com/b/jamesway/archive/2011/05/23/sharepoint-2010-clearing-the-configuration-cache.aspx
http://blog.christophermichaelwebb.com/date/2011/09/
http://support.microsoft.com/kb/939308

Let us know if you have any questions.

 

I promissed I’d put up my presentation that I did at the SharePoint Saturday event on 15 October 2011.

So here it is, please feel free to ask questions:
http://dizzyonsharepoint.files.wordpress.com/2011/10/sharepoint-saturday-presentation2.pptx

Here is a basic step by step:
Open project

Create Visual Web Part

Add code to dialog
<script type=”text/javascript”>
    //Dialog opening
    function OpenDialog() {
        var options = SP.UI.$create_DialogOptions();
        options.url = “/_layouts/SPSCPT_ModalDialog/CreateNewList.aspx”;
        options.width = 500;
        options.height = 400;
        options.dialogReturnValueCallback = Function.createDelegate(null, CloseCallback);
        SP.UI.ModalDialog.showModalDialog(options);
    }

    var messageId;

    // Dialog callback
    function CloseCallback(result, target) {
        if (result === SP.UI.DialogResult.OK) {
            alert(“you clicked on OK!”);
        }
        if (result === SP.UI.DialogResult.cancel) {
            alert(“You clicked on Cancel!”);
        }
    }
</script>
<br />
<asp:HyperLink ID=”HyperLink1″ runat=”server” NavigateUrl=”Javascript:OpenDialog();” Text=”Open Modal Dialog”></asp:HyperLink>

You wont get a result yet, as we will need to create the page which we are pointing our url at.

Create an Application Page at the level you specified previously

PageHead:
<script type=”text/javascript”>

    function BtnCreateListCancel_Click() {
       SP.UI.ModalDialog.commonModalDialogClose(SP.UI.DialogResult.cancel,’Cancelled clicked’);
    }

    function BtnCreateListOk_Click() {
        var form = document.forms.<%SPHttpUtility.NoEncode(Form.ClientID,Response.Output);%>;
        var ListNameUrl = form.<%SPHttpUtility.NoEncode(TxtListName.ClientID,Response.Output);%>.value;
        SP.UI.ModalDialog.commonModalDialogClose(SP.UI.DialogResult.OK, ListNameUrl);
    }

</script>

placeholdermain:
<table id=”maintable” border=”0″ cellspacing=”0″ cellpadding=”0″ width=”100%” >
 <table border=”0″ cellspacing=”1″>
                <tr>
                  <td colspan=”2″ nowrap=”nowrap”>
                    <SharePoint:EncodedLiteral ID=”EncodedLiteral7″ runat=”server” text=”List name will be used as url and as the title” EncodeMethod=’HtmlEncode’/>:
                    <font size=”3″> </font><br />
                  </td>
                </tr>
                <tr>
                  <td dir=”ltr”>
                  <table>
                      <tr>
                          <td nowrap=”nowrap”colspan=”2″class=”ms-authoringcontrols”>
                            <asp:Label Text=”Enter list name” CssClass=”ms-input” ID=”LBLTxtListName” runat=”server” /> 
                          </td>
                          <td nowrap=”nowrap”colspan=”2″class=”ms-authoringcontrols”>
                            <asp:TextBox ID=”TxtListName” runat=”server” Width=255 />
                          </td>
                      </tr>
                  </table>
                  </td>
                </tr>
              </table>
              <asp:placeholder ID=”Placeholder1″ runat=”server”>
          <input type=”button” name=”BtnOk” id=”Button1″
                           value=”OK” onclick=”BtnCreateListOk_Click()”  />
            <SeparatorHtml>
                <span id=”idSpace” />
            </SeparatorHtml>
          <input type=”button” name=”BtnCancel” id=”Button2″
                            value=”Cancel” onclick=”BtnCreateListCancel_Click()” />           
          </asp:PlaceHolder>
</table>

notifications:
// Dialog callback
function CloseCallback(result, target) {
    if (result == SP.UI.DialogResult.OK) {
        //Get id
        messageId = SP.UI.Notify.addNotification(“<img src=’_layouts/images/loading.gif’> Creating list <b>” + target + “</b>…”, true, “Dialog response”, null);
        //Create list using client OM
        //createList(target);
    }
    if (result == SP.UI.DialogResult.cancel) {
        SP.UI.Notify.addNotification(“Operation was cancelled…”, false, “”, null);
    }
}

Un comment the createList(target); code.
Use the JavaScript OM to creat the list when OK is clicked:
//Actual JS client side object model calls
function createList(listName) {
    //Create client context.
    var clientContext = new SP.ClientContext();
    var oWebsite = clientContext.get_web();

    //Let’s create list creation information object
    var listCreationInfo = new SP.ListCreationInformation();
    listCreationInfo.set_title(listName);
    listCreationInfo.set_templateType(SP.ListTemplateType.announcements);
    listCreationInfo.set_quickLaunchOption(SP.QuickLaunchOptions.on);

    this.oList = oWebsite.get_lists().add(listCreationInfo);

    //Let’s create also new item to the list to be created
    var itemCreateInfo = new SP.ListItemCreationInformation();
    this.oListItem = oList.addItem(itemCreateInfo);
    oListItem.set_item(‘Title’, ‘Example item for ‘ + listName);
    oListItem.set_item(‘Body’, ‘Hello seminar audience. From list ‘ + listName);
     oListItem.update();

    clientContext.load(oListItem);
    clientContext.load(oList);

    //Execute the actual script
    clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed));
}

//Called if client side OM is successful
function onQuerySucceeded() {
    //Remove the ‘creating’ event notification
    SP.UI.Notify.removeNotification(messageId);
    //Add ‘created’ notification as non sticky
    SP.UI.Notify.addNotification(“List <b>” + oList.get_title() + “</b> created…”, false, “”, null);
}

function onQueryFailed(sender, args) {
    //Remove the ‘creating’ event notification
    SP.UI.Notify.removeNotification(messageId);
    //Shown in case of error on the JS OM call
    SP.UI.Notify.addNotification(“Operation was cancelled…”, false, “”, null);
 }

———————————————————————–
Notifications and status bar functionality is included in the SP.js file,
the dialog framework code is included in the SP.UI.Dialog.js file.

To get IntelliSense support in Visual Studio when writing JavaScript that targets the dialog framework, add the following reference element to the JavaScript file:
/// <reference path=”C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS\SP.UI.Dialog.debug.js” />

The SP.UI.ModalDialog class is accessible through the SharePoint JavaScript file called SP.UI.Dialog.js which is located in the layouts directory.

Properties available in SP.UI.DialogOptions. Here is a list of the parameters and their use:

url: Contains the URL of the page that appears in the dialog.
html: Contains the HTML of the page that appears in the dialog. Note: if both url and html are specified, url wins. One of these must be specified.
title: Contains the title of the dialog. Optional.
args: Contains an object or other data that are passed to the dialog. Optional.
x – Contains the x-offset of the dialog. Works like the CSS left value.
y – Contains the y-offset of the dialog. Works like the CSS top value.
width – Contains the width of the dialog. The default is 768 if not specified and autosizing is disabled. If width is not specified, the width will be autosized by default. If autosizing is off, the default value is used for the width.
height – Contains the height of the dialog. The default is 576 if not specified and autosizing is disabled. If height is not specified, the height will be autosized by default. If autosizing is off, the default value is used for the height.
dialogReturnValueCallback – Contains the return callback function. The function should take two parameters–a dialogResult that is of type SP.UI.DialogResult and a returnValue that contains any data returned by the dialog.
allowMaximize – Contains a Boolean that specifies if the dialog can be maximized. When this is true, the maximize button is shown. When this is false, the maximize button is not shown.
showMaximize – Contains a Boolean that specifies if the dialog opens in a maximized state. When this is true, the dialog is maximized when opened. When this is false, the dialog is opened at (1) the requested size if specified, (2) the default size, or (3) the autosized size.
showClose – Contains a Boolean that specifies if the close button appears on the dialog.
autoSize – Contains a Boolean that specifies if the dialog platform handles the window sizing.