Thursday, October 31, 2013

Powershell to list all webs with UI version 3 for sharepoint 2013 upgrade purpose


Add-Pssnapin Microsoft.SharePoint.Powershell
 
$s | Get-SPSite -limit all | ForEach-Object {$site =$_;

$site | Get-SPWeb -limit all | ForEach-Object {

if($_.UIVersion -eq 3)

{

write-host "UI version : " $_.UIVersion  $_.Url

}

}}

SharePoint 2010 and Project Web app error provisioning

Had a strange error the other day with provisioning a Project Web Application (PWA).  

The errors didn't really say much except these three event log items.  Errors below. 

To resolve I have to create the PWA site on another environment and then do a back up and restore to a site collection in the environment that was breaking.   then run the provisioning on central admin.  Everything works great after. 


- <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">

- <System>

<Provider Name="Microsoft-SharePoint Products-Project Server" Guid="{B2178104-...}" />

<EventID>7381</EventID>

<Version>14</Version>

<Level>2</Level>

<Task>20</Task>

<Opcode>0</Opcode>

<Keywords>0x4000000000000000</Keywords>

<TimeCreated SystemTime="2013-10-23T21:08:38.396865600Z" />

<EventRecordID>251151</EventRecordID>

<Correlation ActivityID="{DE39B42B...}" />

<Execution ProcessID="7972" ThreadID="4988" />

<Channel>Application</Channel>

<Computer>xxx.domain.com</Computer>

<Security UserID="S-1-5..." />

</System>

<EventData />

</Event>
-----------------------------------------------------------------
- <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">

- <System>

<Provider Name="Microsoft-SharePoint Products-Project Server" Guid="{B2178104..}" />

<EventID>6966</EventID>

<Version>14</Version>

<Level>2</Level>

<Task>20</Task>

<Opcode>0</Opcode>

<Keywords>0x4000000000000000</Keywords>

<TimeCreated SystemTime="2013-10-23T21:08:39.100031100Z" />

<EventRecordID>251152</EventRecordID>

<Correlation ActivityID="{DE39B42B...}" />

<Execution ProcessID="7972" ThreadID="4988" />

<Channel>Application</Channel>

<Computer>xxx.domain.com</Computer>

<Security UserID="S-1-5..." />

</System>

- <EventData>

<Data Name="string0">PW</Data>

<Data Name="string1">Microsoft.Office.Project.Server.Administration.ProvisionException: Post provisioning setup failed. at Microsoft.Office.Project.Server.Administration.PsiServiceApplication.CreateSite(ProjectProvisionSettings provset)</Data>

</EventData>

</Event>
-------------------------------------------------------------------------------------------------
- <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">

- <System>

<Provider Name="Microsoft-SharePoint Products-Project Server" Guid="{B2178104...}" />

<EventID>6971</EventID>

<Version>14</Version>

<Level>2</Level>

<Task>20</Task>

<Opcode>0</Opcode>

<Keywords>0x4000000000000000</Keywords>

<TimeCreated SystemTime="2013-10-25T18:11:34.919153600Z" />

<EventRecordID>252921</EventRecordID>

<Correlation ActivityID="{27BA856F...}" />

<Execution ProcessID="9040" ThreadID="2700" />

<Channel>Application</Channel>

<Computer>xxx.domain.com</Computer>

<Security UserID="S-1-5..." />

</System>

- <EventData>

<Data Name="string0">/PWA</Data>

<Data Name="string1">Microsoft.Office.Project.Server.Administration.ProvisionException: Post provisioning setup failed. at Microsoft.Office.Project.Server.Administration.PsiServiceApplication.CreateSite(ProjectProvisionSettings provset)</Data>

</EventData>

</Event>

Thursday, October 17, 2013

Simple powershell to set key/value pair in the web application properties

-Don't forget to add the snap in if not using the sharepoint ps console.

function SetPropertyBag ($webAppUrl, $key, $value) {

    $spwebApp=Get-SPWebApplication -Identity $webAppUrl
    Write $spwebApp

    if($spwebApp.AllProperties.ContainsKey($key) -eq $False)
    {
        $spwebApp.AllProperties.Add($key,$value);      
    }
    else
    {$spwebApp.AllProperties[$key]=$value; }

    Write-Host -foregroundcolor Green "value set in "  $key  " = "  $spwebApp.AllProperties[$key]  

    }

$webAppUrl= Read-Host 'Enter the web application url';

$keystring= Read-Host 'Enter the key string';
$valuestring= Read-Host 'Enter the value string';
SetPropertyBag $webAppUrl $keystring $valuestring;

Wednesday, September 4, 2013

TFS 2012 web access 'b' is null or not an object error on the product backlog board

If the user clicks on the board tab on the product backlog,  the first time the board renders without any issues.

Check to see if you are using IE8 or below for TFS 2012 web access.   IE8 is not supported. 

Tuesday, August 20, 2013

SharePoint 2013 migration issue with the SP.UI.ModalDialog error in javascript of CEWP

When there are javascript added to the Content Editor Web Part in SharePoint 2010, to open the dialog the code below is how you would do it but it breaks when you upgrade to 2013.

This works best if you add the new Script Webpart to the page and copy and paste all the scripts from the CEWP and leave the html as is.  

function openFormDialog(formtitle, formurl)
{
 var options = {
             url: formurl,
             tite: formtitle
         };

         SP.UI.ModalDialog.showModalDialog(options);
}

breaks in 2013

to fix the issue change the call to

function openFormDialog(formtitle, formurl)
{
 var options = {
             url: formurl + "?IsDlg=1",
             tite: formtitle
         };

SP.SOD.execute('sp.ui.dialog.js', 'SP.UI.ModalDialog.showModalDialog', options);
}

SharePoint 2013 migration issue with javascript only content editor webpart breaking the webpart page and closes the browser

Here is a simple script to output the contents of the CEWP to be ran on the 2010 environment to investigate the potential issues you might encounter for javascript only CEWP when it gets migrated to 2013.


$siteUrl = "http://localhost"
$site = Get-SPSite $siteUrl
$cewpCount = 0
$cewps = New-Object Hashtable
$site.AllWebs | % {

     $pageUrl = $_.RootFolder.WelcomePage;
     $pageUrlFull = ($_.Url + "/" + $pageUrl);
     if($pageUrl.Length -gt 0 )
     {
       $parts = $_.GetWebPartCollection($pageUrl, 2)
         $parts | ? { $_.WebBrowsableObject.ToString() -eq "Microsoft.SharePoint.WebPartPages.ContentEditorWebPart" } | % {
         $ce = [Microsoft.SharePoint.WebPartPages.ContentEditorWebPart]$_
         Write-Host "Found on Page URL: " $pageUrlFull $_.StorageKey $ce.Title -ForegroundColor Green
          Write-Host $ce.Content.InnerText
          $cewpCount += 1;
          $cewps.Add($_.StorageKey, $pageUrlFull); }
      }    
    }
          
Write-Host "Found" $cewpCount "CEWPs" -ForegroundColor Green




Friday, August 16, 2013

SharePoint CAML query to get Todays events in calendar list

<Query>
    <OrderBy>
<FieldRef Name="EventDate"/>
</OrderBy>
<Where>
<And>
<DateRangesOverlap>
<FieldRef Name="EventDate"/>
<FieldRef Name="EndDate"/>
<FieldRef Name="RecurrenceID"/>
<Value Type="DateTime" IncludeTimeValue="False">
       <Today/>
                </Value>
            </DateRangesOverlap>
            <Lt>
                <FieldRef Name="EventDate"/>
                <Value Type="DateTime">
                   <Today/>
                </Value>
            </Lt>
        </And>
    </Where>
    <QueryOptions>
        <IncludeMandatoryColumns>false</IncludeMandatoryColumns>
        <ViewAttributes Scope="Recursive"/>
        <RecurrencePatternXMLVersion>v3</RecurrencePatternXMLVersion>
        <ExpandRecurrence>true</ExpandRecurrence>
        <RecurrenceOrderBy>true</RecurrenceOrderBy>
        <ViewAttributes Scope="RecursiveAll"/>
        <CalendarDate>
        <Today/>
        </CalendarDate>
    </QueryOptions>
</Query>