Tuesday, August 5, 2014

Sharepoint List view showing raw html

This is a simple fix.  Modify the webpart settings:

Go to Miscellaneous:

Check the "Server Render"

Ok or Apply.

Stop editing the page.

Done!!!!

:)

Tuesday, July 29, 2014

Create a new the crawl database and replace the old or corrupted crawl database in SharePoint 2013 Search

Recently the crawl database in sharepoint search got corrupted.   After we fixed the indexes, it kept getting corrupted so we just recreated the database and the issues went away.  Here are the steps and power shell.


#You will need to change the search service application name, also your sql server name, and the guid of you crawl store. 




Add-PSSnapin Microsoft.SharePoint.PowerShell


#List all crawl database:


Get-SPEnterpriseSearchCrawlDatabase -SearchApplication "Search service Application"




#Create a new Crawl database: 

New-SPEnterpriseSearchCrawlDatabase -DatabaseName "Search_Service_Application_CrawlStoreDB" -DatabaseServer "SQLServerName" -SearchApplication "Search Service Application"




#Delete the crawl store that is corrupted or old.

$ssa = Get-SPEnterpriseSearchServiceApplication -Identity "Search service Application"
$cs = $ssa.CrawlStores


#list the crawl stores to find the corrupted or old one

$cs


#delete the old/corrupted store


$cs1 = $cs.Item("GUID of Old database")
$cs1.Delete()




# if the search is in a System paused for refactoring, use the command below to normal


#$ssa = Get-SPEnterpriseSearchServiceApplication -Identity "Search service Application"
#$ssa.ForceResume($ssa.IsPaused())



Wednesday, June 25, 2014

SharePoint 2010 Custom Workflow Actions in SharePoint 2013

After upgrading the error comes up that the action can not load the class.  

Error:  Could not deserialize object. The type 'MyCustom.WorkflowActions.StartAworkflowOnAnotherList' could not be resolved.

Before in 2010:

<System.Workflow.ComponentModel.WorkflowCompiler>
    <authorizedTypes>
          <authorizedType .....>

In SharePoint 2013 after the upgrade which causes this break:

<System.Workflow.ComponentModel.WorkflowCompiler>
    <authorizedTypes>
      <targetFx version="v4.0">
      </targetFx>
       <authorizedType Assembly="MyCustom.WorkflowActions.StartAworkflowOnAnotherList.....>


To fix:

<System.Workflow.ComponentModel.WorkflowCompiler>
    <authorizedTypes>
      <targetFx version="v4.0">
            <authorizedType Assembly="MyCustom.WorkflowActions.StartAworkflowOnAnotherList.....>
      </targetFx>
       

Thursday, February 20, 2014

SharePoint 2010 and SCOM 2012 R2 with APM starts csc.exe instances which overloads the server resources. SCOM 2012 R2 with APM errors with .NET 2.0

The WFE servers resources get overloaded or maxed out with instances of csc.exe running when a site is called.  No real errors are displayed in the event viewer.
Pages do not get loaded due to time outs with the memory and the processors being maxed out.

To resolved till they fix SCOM 2012 R2 APM issues with .NET 2.0, you will need to uninstall from all programs the Microsoft Monitoring and reboot.  Or revert back to SCOM 2012 SP1 agent.

Then all sites are back to normal.  

Tuesday, February 4, 2014

Distributed Cache Powershell commands

From http://technet.microsoft.com/en-us/library/jj219613.aspx
Change the service account running the Distributed Cache
It is recommended to use a SharePoint managed account for this service.
$spfarm = Get-SPFarm
$spcacheService = $spfarm.Services | where {$_.Name -eq “AppFabricCachingService”}
$spaccount = Get-SPManagedAccount -Identity domain\spdistcache$spcacheService.ProcessIdentity.CurrentIdentityType = “SpecificUser”
$spcacheService.ProcessIdentity.ManagedAccount = $spaccount
$spcacheService.ProcessIdentity.Update()
$spcacheService.ProcessIdentity.Deploy()

Graceful stop and deattach local server (No lost cache data)
Stop-SPDistributedCacheServiceInstance -Graceful
Remove-SPDistributedCacheServiceInstance
Deattach local server from a cache cluster (Multiple Distributed Cache servers)
Remove-SPDistributedCacheServiceInstance
Reattach local server to a cache cluster (Multiple Distributed Cache servers)
Add-SPDistributedCacheServiceInstance
Delete the service
$instanceName =”SPDistributedCacheService Name=AppFabricCachingService”
$serviceInstance = Get-SPServiceInstance | ? {($_.service.tostring()) -eq $instanceName -and ($_.server.name) -eq $env:computername}
$serviceInstance.delete()
Verify in Central Admin, System Settings, Manage Services on Server. It should be gone from this list when it has been completely deleted.
In a multi server farm, you will have to select which server to show the services from in the top-right dropdown.
Create a new service
Add-SPDistributedCacheServiceInstance
Verify in Central Admin, System Settings, Manage Services on Server. It should appear in this list when it has been created. In a multi server farm, you will have to select which server to show the services from in the top-right dropdown.
Start the service on a server
$instanceName =”SPDistributedCacheService Name=AppFabricCachingService”
$serviceInstance = Get-SPServiceInstance | ? {($_.service.tostring()) -eq $instanceName -and ($_.server.name) -eq $env:computername}
$serviceInstance.Provision()
Stop the service on a server
$instanceName =”SPDistributedCacheService Name=AppFabricCachingService” $serviceInstance = Get-SPServiceInstance | ? {($_.service.tostring()) -eq $instanceName -and ($_.server.name) -eq $env:computername}
$serviceInstance.Unprovision()
Check current Cache memory allocation
Use-CacheCluster Get-AFCacheHostConfiguration -ComputerName $env:computername -CachePort “22233″
Change the Cache memory allocation
On all Cache servers in the farm stop the service
$instanceName =”SPDistributedCacheService Name=AppFabricCachingService” $serviceInstance = Get-SPServiceInstance | ? {($_.service.tostring()) -eq $instanceName -and ($_.server.name) -eq $env:computername}
$serviceInstance.Unprovision()
Update the memory allocation
Update-SPDistributedCacheSize -CacheSizeInMB CacheSize
Start the service on all Cache servers
$instanceName =”SPDistributedCacheService Name=AppFabricCachingService” $serviceInstance = Get-SPServiceInstance | ? {($_.service.tostring()) -eq $instanceName -and ($_.server.name) -eq $env:computername}
$serviceInstance.Provision()


Remove a host from the cluster: if all else failes
Stop-CacheHost -HostName <servername> -CachePort 22233


Unregister-CacheHost -HostName <servername> -RemoveServicePermissions -ProviderType SPDistributedCacheClusterProvider -ConnectionString 'Data Source=<dbservername>;Initial Catalog=<SharePoint_Config>;Integrated Security=True;Enlist=False'

Wednesday, January 29, 2014

SharePoint 2013 Global navigation: Wrap the menu items

In the master page, there needs to be three things added and one setting modified.  Then you'll have to add to your custom css file (this part is optional but after you see the menu, you'll want to add this).

The items to add to your master file in the SharePoint:AspMenu are:
ItemWrap="true"
RenderingMode="List"
cssClass="mycss-aspmenuclass"

The item to change in the master page setting UseSimpleRendering to false.

this is that it looks like out of the box:

------------------------------------------------------------
<SharePoint:AspMenu
   ID="TopNavigationMenu"
   Runat="server"
   EnableViewState="false"
   DataSourceID="topSiteMap"
   AccessKey="<%$Resources:wss,navigation_accesskey%>"
   UseSimpleRendering="true"
   UseSeparateCss="false"
   Orientation="Horizontal"
   StaticDisplayLevels="2"
   AdjustForShowStartingNode="true"
   MaximumDynamicDisplayLevels="2"
   SkipLinkText="" />
------------------------------------------------------------

this is what it should look like after your changes.
-------------------------------------------------------------
<SharePoint:AspMenu
   ID="TopNavigationMenu"
   Runat="server"
   EnableViewState="false"
   DataSourceID="topSiteMap"
   AccessKey="<%$Resources:wss,navigation_accesskey%>"
   UseSimpleRendering="false"
   UseSeparateCss="false"
   Orientation="Horizontal"
   StaticDisplayLevels="2"
   AdjustForShowStartingNode="true"
   MaximumDynamicDisplayLevels="2"
   SkipLinkText=""
   ItemWrap="true"
   RenderingMode="List"
   cssClass="mycss-aspmenuclass"/>

---------------------------------------------------------------
Now add to your custom css file three items so that there is some space between the menu items.

.mycss-aspmenuclass .level1   
{
 margin-left: 10px;
 margin-right: 20px;
}
.mycss-aspmenuclass .level2
{
 margin-left: 10px;
 margin-right: 20px;
}
.mycss-aspmenuclass .level3
{
 margin-left: 10px;
 margin-right: 20px;
}

 

Thursday, December 5, 2013

Fix a Secure Store service or any SharePoint service stuck on starting or stopping

change the "Server Name" in the script.  To stop change Provision() to UnProvision()

one thing to note is that if the status is provisioning, then you'll most likely need to Provision() then UnProvision().

Also all you need to do is get the service instance for other services by the type or name. 

--------------------------------------------------------------
add-pssnapin MIcrosoft.SharePoint.Powershell

Function MatchComputerName($computersList, $computerName)
{
                If ($computersList -like "*$computerName*") { Return $true; }
    foreach ($v in $computersList) {
      If ($v.Contains("*") -or $v.Contains("#")) {
            # wildcard processing
            foreach ($item in -split $v) {
                $item = $item -replace "#", "[\d]"
                $item = $item -replace "\*", "[\S]*"
                if ($computerName -match $item) {return $true;}
            }
        }
    }
}

           $secureStoreServiceInstances = Get-SPServiceInstance | ? {$_.GetType().Equals([Microsoft.Office.SecureStoreService.Server.SecureStoreServiceInstance])}
            $secureStoreServiceInstance = $secureStoreServiceInstances | ? {MatchComputerName $_.Server.Address "Server Name"}
           
            Write-HOst $secureStoreServiceInstance.Status

            $secureStoreServiceInstance.Provision()