Tag Archives: asphostportal

SharePoint 2013 Hosting :: How To Update Conflict Error in SharePoint Using PowerShell Script

Hi guys this article explains you about How To Update Conflict Error in SharePoint Using PowerShell Script. Many of you must have come across the issue “An update conflict has occurred and you must re-try this action” and it is suggested to remove the file system cache on the front-end servers. There are many articles to show how to do this manually. But here I will show you how to resolve it using a PowerShell script.

Cause for this issue

This issue occurs if the contents of the file system cache on the front-end servers are newer than the contents of the configuration database.

Resolution

To resolve this issue, clear the file system cache on all servers in the server Farm on which the Windows SharePoint Services Timer service is running. This can be done manually, but consider a large Farm where the administrator needs to login to each of the servers to perform the activity manually. It is time-consuming and people can make mistakes. PowerShell becomes handy here.

The following procedure can resolve the issue:

  1. Stop the SharePoint timer service
  2. Take a backup of the system cache files before deleting it
  3. Delete the XML files from the cache folder
  4. Reset the cache.ini file to the value 1
  5. Start the SharePoint timer service

Now I will explain how to perform the preceding tasks using a PowerShell script.

  • Stop SharePoint timer service

The following piece of code stops the SharePoint timer service:

    Function StopSPTimerServicesInFarm([Microsoft.SharePoint.Administration.SPFarm]$farm)  
    {  
        Write-Host ""  
        foreach($server in $farm.Servers)  
            {  
            foreach($instance in $server.ServiceInstances)  
                    {  
                            # If the server has the timer service then stop the service  
                           if($instance.TypeName -eq $timerServiceInstanceName)  
                           {  
                                [string]$serverName = $server.Name  
       
                                Write-Host "Stop " $timerServiceName " service on server: " $serverName -fore yellow  
                                   
                                $service = Get-WmiObject -ComputerName $serverName Win32_Service -Filter "DisplayName='$timerServiceName'"  
                                $serviceInternalName = $service.Name  
                                sc.exe \\$serverName stop $serviceInternalName > $null  
      
                                  # Wait until this service has actually stopped  
                      write-host "Waiting for '$timerServiceName' service on server: " $serverName " to be stopped" -fore yellow  
                                  do  
                          {  
                                  Start-Sleep 1  
                                  Write-Host -foregroundcolor DarkGray -NoNewLine "."  
                                  $service = Get-WmiObject -ComputerName $serverName Win32_Service -Filter "DisplayName='$timerServiceName'"  
                          }  
                         while ($service.State -ne "Stopped")  
                     write-host " '$timerServiceName' service on server: " $serverName " stopped successfully" -fore green              
                                 break;  
                           }  
                    }  
            }  
       
            Write-Host ""  
    }
  • Backup config cache files

The following piece of code backs up the config cache files before deleting it:

Function BackupSPConfigFiles([Microsoft.SharePoint.Administration.SPFarm]$farm)  
{  
    write-host ""  
    write-host "Backup SP config cache files" -fore yellow  
      
    foreach($server in $farm.servers)  
    {  
        foreach($instance in $server.ServiceInstances)  
        {  
            if($instance.TypeName -eq $timerServiceInstanceName)  
            {  
                $ServerName = $server.name  
                $FolderName  = $servername + "SPConfigCacheBackup"  
                write-host "Creating a folder to hold the backup files" -fore magenta  
                write-host "Checking whether the folder aleady exist"  
                if(Test-path $scriptbase\$FolderName)  
                {  
                    write-host "Folder already exists and the script is deleting it......"  
                    remove-item $scriptbase\$FolderName -recurse -confirm:$false   
                    write-host "Existing folder deleted" -fore green  
                }  
                else  
                {  
                    write-host "Folder does not exist"  
                }  
                New-Item $scriptbase\$FolderName -type directory  
                write-host "New folder created to hold the backup files" -fore magenta  
                write-host "Backup of SP config files for the server " $serverName " started ...... " -fore yellow  
                $path = "\\" + $serverName + "\c$\ProgramData\Microsoft\SharePoint\Config"  
                Copy-Item $path -Destination $scriptbase\$FolderName -recurse  
                write-host "SP config cache files backed up for the server " $serverName " Sucessfully..." -fore green  
            }  
        }  
    }  
    write-host "SP config caches files are backed up" -fore green  
    write-host ""  
}
  • Deleting XML files

The following piece of code deletes the XML files:

    Function DeletingXMLFiles([Microsoft.SharePoint.Administration.SPFarm]$farm)  
    {  
        Write-host ""  
        write-host "Deleting SP config cache XML files from each server in the farm" -fore yellow  
        $path = ""  
        foreach($server in $farm.servers)  
        {  
            foreach($instance in $server.ServiceInstances)  
            {  
                if($instance.TypeName -eq $timerServiceInstanceName)  
                {  
                    $serverName = $server.Name  
                    write-host "Deleting SP config cache files from the server " $servername -fore magenta  
                    $path = "\\" + $serverName + "\c$\ProgramData\Microsoft\SharePoint\Config\*-*\*.xml"  
                    remove-item -path $path -force  
                    write-host "SP config cache files deleted on the server " $servername -fore magenta  
                    break  
                }  
            }  
        }  
        write-host "SP config cache XML files from each server in the farm is deleted successfully......" -fore green  
        write-host ""  
    }
  • Reset timer cache

The following piece of code resets the timer cache:

Function ResetTimerCache([Microsoft.SharePoint.Administration.SPFarm]$farm)  
{  
    write-host ""  
    write-host "Reseting the value of timer cache to 1" -fore yellow  
    $path = ""  
    foreach($server in $farm.servers)  
    {  
        foreach($instance in $server.ServiceInstances)  
        {  
            if($instance.TypeName -eq $timerServiceInstanceName)  
            {  
                $serverName = $server.Name  
                write-host "Reseting the value of timer cache file in server " $serverName -fore magenta  
                $path = "\\" + $serverName + "\c$\ProgramData\Microsoft\SharePoint\Config\*-*\cache.ini"  
                Set-Content -path $path -Value "1"  
                write-host "Value of timer cache file in server " $serverName " is resetted to 1" -fore magenta  
                break  
            }  
        }  
    }  
    write-host "The value of timer cache is resetted to 1 in all the SP servers in the farm" -fore green  
    write-host ""  
}
  • Start SharePoint timer service
    Function StartSPTimerServicesInFarm([Microsoft.SharePoint.Administration.SPFarm]$farm)  
    {  
        Write-Host ""  
        foreach($server in $farm.Servers)  
            {  
            foreach($instance in $server.ServiceInstances)  
                    {  
                            # If the server has the timer service then stop the service  
                           if($instance.TypeName -eq $timerServiceInstanceName)  
                           {  
                                [string]$serverName = $server.Name  
       
                                Write-Host "Start " $timerServiceName " service on server: " $serverName -fore yellow  
                                   
                                $service = Get-WmiObject -ComputerName $serverName Win32_Service -Filter "DisplayName='$timerServiceName'"  
                                $serviceInternalName = $service.Name  
                                sc.exe \\$serverName start $serviceInternalName > $null  
      
                                  # Wait until this service starts running  
                      write-host "Waiting for " $timerServiceName " service on server: " $serverName " to be started" -fore yellow  
                                  do  
                          {  
                                  Start-Sleep 1  
                                  Write-Host -foregroundcolor DarkGray -NoNewLine "."  
                                  $service = Get-WmiObject -ComputerName $serverName Win32_Service -Filter "DisplayName='$timerServiceName'"  
                          }  
                         while ($service.State -ne "Running")  
                     write-host $timerServiceName " service on server: " $serverName " started successfully" -fore green              
                                 break;  
                           }  
                    }  
            }  
       
            Write-Host ""  
    }
  • Complete Code
    $LogTime = Get-Date -Format yyyy-MM-dd_hh-mm  
    $LogFile = ".\ClearSPConfigCachePatch-$LogTime.rtf"  
    # Add SharePoint PowerShell Snapin  
    if ( (Get-PSSnapin -Name Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue) -eq $null ) {  
        Add-PSSnapin Microsoft.SharePoint.Powershell  
    }  
    $scriptBase = split-path $SCRIPT:MyInvocation.MyCommand.Path -parent  
    Set-Location $scriptBase  
    #Deleting any .rtf files in the scriptbase location  
    $FindRTFFile = Get-ChildItem $scriptBase\*.* -include *.rtf  
    if($FindRTFFile)  
    {  
        foreach($file in $FindRTFFile)  
            {  
                remove-item $file  
            }  
    }      
    start-transcript $logfile  
    Write-host "##############Following steps will be involved################" -fore green  
    write-host "Step 1 - Stop the timerservice" -fore cyan  
    write-host "Step 2 - Take the backup of config cache file" -fore cyan  
    write-host "Step 3 - Delete the XML files" -fore cyan  
    write-host "Step 4 - Reset the cache.ini file" -fore cyan  
    write-host "Step 5 - Start the SP timerservice" -fore cyan  
    Write-host "##############Above steps will be involved##################" -fore green  
      
    $global:timerServiceName = "SharePoint 2010 Timer"  
    $global:timerServiceInstanceName = "Microsoft SharePoint Foundation Timer"  
   
    # Get the local farm instance  
    [Microsoft.SharePoint.Administration.SPFarm]$farm = [Microsoft.SharePoint.Administration.SPFarm]::get_Local()  
    Function StopSPTimerServicesInFarm([Microsoft.SharePoint.Administration.SPFarm]$farm)  
    {  
        Write-Host ""  
        foreach($server in $farm.Servers)  
            {  
            foreach($instance in $server.ServiceInstances)  
                    {  
                            # If the server has the timer service then stop the service  
                           if($instance.TypeName -eq $timerServiceInstanceName)  
                           {  
                                [string]$serverName = $server.Name  
       
                                Write-Host "Stop " $timerServiceName " service on server: " $serverName -fore yellow  
                                   
                                $service = Get-WmiObject -ComputerName $serverName Win32_Service -Filter "DisplayName='$timerServiceName'"  
                                $serviceInternalName = $service.Name  
                                sc.exe \\$serverName stop $serviceInternalName > $null  
      
                                  # Wait until this service has actually stopped  
                      write-host "Waiting for '$timerServiceName' service on server: " $serverName " to be stopped" -fore yellow  
                                  do  
                          {  
                                  Start-Sleep 1  
                                  Write-Host -foregroundcolor DarkGray -NoNewLine "."  
                                  $service = Get-WmiObject -ComputerName $serverName Win32_Service -Filter "DisplayName='$timerServiceName'"  
                          }  
                         while ($service.State -ne "Stopped")  
                     write-host " '$timerServiceName' service on server: " $serverName " stopped successfully" -fore green              
                                 break;  
                           }  
                    }  
            }  
       
            Write-Host ""  
    }  
    Function BackupSPConfigFiles([Microsoft.SharePoint.Administration.SPFarm]$farm)  
    {  
        write-host ""  
        write-host "Backup SP config cache files" -fore yellow  
          
        foreach($server in $farm.servers)  
        {  
            foreach($instance in $server.ServiceInstances)  
            {  
                if($instance.TypeName -eq $timerServiceInstanceName)  
                {  
                    $ServerName = $server.name  
                    $FolderName  = $servername + "SPConfigCacheBackup"  
                    write-host "Creating a folder to hold the backup files" -fore magenta  
                    write-host "Checking whether the folder aleady exist"  
                    if(Test-path $scriptbase\$FolderName)  
                    {  
                        write-host "Folder already exists and the script is deleting it......"  
                        remove-item $scriptbase\$FolderName -recurse -confirm:$false   
                        write-host "Existing folder deleted" -fore green  
                    }  
                    else  
                    {  
                        write-host "Folder does not exist"  
                    }  
                    New-Item $scriptbase\$FolderName -type directory  
                    write-host "New folder created to hold the backup files" -fore magenta  
                    write-host "Backup of SP config files for the server " $serverName " started ...... " -fore yellow  
                    $path = "\\" + $serverName + "\c$\ProgramData\Microsoft\SharePoint\Config"  
                    Copy-Item $path -Destination $scriptbase\$FolderName -recurse  
                    write-host "SP config cache files backed up for the server " $serverName " Sucessfully..." -fore green  
                }  
            }  
        }  
        write-host "SP config caches files are backed up" -fore green  
        write-host ""  
    }  
    Function DeletingXMLFiles([Microsoft.SharePoint.Administration.SPFarm]$farm)  
    {  
        Write-host ""  
        write-host "Deleting SP config cache XML files from each server in the farm" -fore yellow  
        $path = ""  
        foreach($server in $farm.servers)  
        {  
            foreach($instance in $server.ServiceInstances)  
            {  
                if($instance.TypeName -eq $timerServiceInstanceName)  
                {  
                    $serverName = $server.Name  
                    write-host "Deleting SP config cache files from the server " $servername -fore magenta  
                    $path = "\\" + $serverName + "\c$\ProgramData\Microsoft\SharePoint\Config\*-*\*.xml"  
                    remove-item -path $path -force  
                    write-host "SP config cache files deleted on the server " $servername -fore magenta  
                    break  
                }  
            }  
        }  
        write-host "SP config cache XML files from each server in the farm is deleted successfully......" -fore green  
        write-host ""  
    }  
    Function ResetTimerCache([Microsoft.SharePoint.Administration.SPFarm]$farm)  
    {  
        write-host ""  
        write-host "Reseting the value of timer cache to 1" -fore yellow  
        $path = ""  
        foreach($server in $farm.servers)  
        {  
            foreach($instance in $server.ServiceInstances)  
            {  
                if($instance.TypeName -eq $timerServiceInstanceName)  
                {  
                    $serverName = $server.Name  
                    write-host "Reseting the value of timer cache file in server " $serverName -fore magenta  
                    $path = "\\" + $serverName + "\c$\ProgramData\Microsoft\SharePoint\Config\*-*\cache.ini"  
                    Set-Content -path $path -Value "1"  
                    write-host "Value of timer cache file in server " $serverName " is resetted to 1" -fore magenta  
                    break  
                }  
            }  
        }  
        write-host "The value of timer cache is resetted to 1 in all the SP servers in the farm" -fore green  
        write-host ""  
    }  
    Function StartSPTimerServicesInFarm([Microsoft.SharePoint.Administration.SPFarm]$farm)  
    {  
        Write-Host ""  
        foreach($server in $farm.Servers)  
            {  
            foreach($instance in $server.ServiceInstances)  
                    {  
                            # If the server has the timer service then stop the service  
                           if($instance.TypeName -eq $timerServiceInstanceName)  
                           {  
                                [string]$serverName = $server.Name  
       
                                Write-Host "Start " $timerServiceName " service on server: " $serverName -fore yellow  
                                   
                                $service = Get-WmiObject -ComputerName $serverName Win32_Service -Filter "DisplayName='$timerServiceName'"  
                                $serviceInternalName = $service.Name  
                                sc.exe \\$serverName start $serviceInternalName > $null  
      
                                  # Wait until this service starts running  
                      write-host "Waiting for " $timerServiceName " service on server: " $serverName " to be started" -fore yellow  
                                  do  
                          {  
                                  Start-Sleep 1  
                                  Write-Host -foregroundcolor DarkGray -NoNewLine "."  
                                  $service = Get-WmiObject -ComputerName $serverName Win32_Service -Filter "DisplayName='$timerServiceName'"  
                          }  
                         while ($service.State -ne "Running")  
                     write-host $timerServiceName " service on server: " $serverName " started successfully" -fore green              
                                 break;  
                           }  
                    }  
            }  
       
            Write-Host ""  
    }         
    #############Calling functions################  
    StopSPTimerServicesInFarm $farm  
    BackupSPConfigFiles $farm  
    DeletingXMLFiles $farm  
    ResetTimerCache $farm  
    StartSPTimerServicesInFarm $farm  
    ##########################################    
    write-host "SCRIPT COMPLETED" -fore cyan  
    stop-transcript

Execution Procedure

  1. Step 1: Download the script and copy it to the SharePoint server.
  2. Step 2: Navigate to the script path.
  3. Step 3: Execute the script.

Best Recommended SharePoint 2013 Hosting

ASPHostPortal.com

ASPHostPortal.com is Perfect, suitable hosting plan for a starter in SharePoint. ASPHostPortal  the leading provider of Windows hosting and affordable SharePoint Hosting. ASPHostPortal proudly working to help grow the backbone of the Internet, the millions of individuals, families, micro-businesses, small business, and fledgling online businesses. ASPHostPortal has ability to support the latest Microsoft and ASP.NET technology, such as: WebMatrix, WebDeploy, Visual Studio 2015, .NET 5/ASP.NET 4.5.2, ASP.NET MVC 6.0/5.2, Silverlight 6 and Visual Studio Lightswitch, ASPHostPortal guarantees the highest quality product, top security, and unshakeable reliability, carefully chose high-quality servers, networking, and infrastructure equipment to ensure the utmost reliability

 

 

 

SharePoint 2013 Hosting :: Duplicate Web Part Issue in SharePoint 2013

Today for something regarding one of the new features of SharePoint 13. There is the new attribute “ReplaceContent=TRUE” for the <File> element in <Module>.

Until SharePoint 2010, whenever we reactivate the PageLayout feature (the feature that provisions the page layouts in a master page gallery), web parts that have been added to the page layout are duplicated on the new page and we do not have a very standard solution to resolve this problem except for writing a feature receiver and removing the duplicated web parts.

ahp banner sharepoint-01
In SharePoint 2013 is the new attribute “ReplaceContent=TRUE” of the <File> element and if we use this when provisioning the page layout it overrides the existing web parts on the page layouts. So whenever we create a new page from the given page layouts, web parts are not duplicated.

    <Elements xmlns="http://schemas.microsoft.com/sharepoint/">  
      <Module Name="MyPageLayouts" Url="_catalogs/masterpage" RootWebOnly="TRUE">  
        <File Path="MyPageLayouts\MyPageLayout.aspx" Url="MyPageLayouts.Intranet/MyPageLayout.aspx" Type="GhostableInLibrary" ReplaceContent="TRUE">       
    <!—- All our web parts goes here -->  
        </File>  
      </Module>

Have a look at the preceding example, I have set the ReplaceContent=”TRUE”. Because of this whenever I change, add or delete a web part in this elements.xml file and I need to reactivate the feature, the web parts on the page layouts are not duplicated but they do get overridden.

Other Usage example

I’ll like to share one more scenario related to this, I have a sandbox solution that I am deploying on Office 365. I was uploading my package file (.wsp) to the Solution Gallery and activating it. In my package I have one feature that is deploying my CSS file in the master page gallery since I do not have file system access. I had a change in CSS file, I did the change, packaged the solution, deactivated the solution first, uploaded it to the solution gallery and activated it. But my CSS changes are not reflected. Then I remembered the “ReplaceContent” attribute and I used it in the module element while provisioning the CSS file and wonder happened? It worked like a charm.

Feel free if you have some thoughts on this or please share your experience. Thanks :)

Best Recommended SharePoint 2013 Hosting

ASPHostPortal.com

ASPHostPortal.com is Perfect, suitable hosting plan for a starter in SharePoint. ASPHostPortal  the leading provider of Windows hosting and affordable SharePoint Hosting. ASPHostPortal proudly working to help grow the backbone of the Internet, the millions of individuals, families, micro-businesses, small business, and fledgling online businesses. ASPHostPortal has ability to support the latest Microsoft and ASP.NET technology, such as: WebMatrix, WebDeploy, Visual Studio 2015, .NET 5/ASP.NET 4.5.2, ASP.NET MVC 6.0/5.2, Silverlight 6 and Visual Studio Lightswitch, ASPHostPortal guarantees the highest quality product, top security, and unshakeable reliability, carefully chose high-quality servers, networking, and infrastructure equipment to ensure the utmost reliability

 

 

SharePoint 2013 Hosting :: How To Retrieve Followed Sites in SharePoint 2013 Using REST API

This article explains how to retrieve the site name and URL followed by the current user in SharePoint 2013 using a client object model (REST API and JavaScript)

We can use the SharePoint 2013 Representational State Transfer (REST) service to do the same tasks you can do when you use the .NetCSOM, JSOM.
Here I explain how to retrieve the site name and URL followed by the current user in SharePoint 2013 using a client object model (REST API and JavaScript) and displaying it in the SharePoint page.

  • Create a new page and a Content Editor Webpart (CEWP)

Create a New page

  • Edit the web part that was added to the page.
  • Upload your text file script into the site assests and copy the path of the text file and paste it into the Content link in CEWP.

Code

The following example shows how to retrieve all of the following sites:

<html>    
    <head>    
       <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>    
          <script type="text/javascript">  
             var followingManagerEndpoint;  
             var followedCount; 
             var followingEndpoint;    
             var URL;    
             var website;    
             var clientContext;  
             SP.SOD.executeFunc('sp.js', 'SP.ClientContext', loadWebsite);    
             function loadWebsite() {    
                clientContext = SP.ClientContext.get_current();    
                website = clientContext.get_web();    
                clientContext.load(website);    
                clientContext.executeQueryAsync(onRequestSucceeded, onRequestFailed);    
             }    
             function onRequestSucceeded() {   
               URL = website.get_url();    
               followingManagerEndpoint = decodeURIComponent(URL) + "/_api/social.following";   
               getMyFollowedContent();  
            }    
            function onRequestFailed(sender, args) {    
              alert('Error: ' + args.get_message());    
            }   
            // Get the content that the current user is following.  
            // The "types=14" parameter specifies all content types  
            // (documents = 2 + sites = 4 + tags = 8).  
           function getMyFollowedContent() {  
             $.ajax( {  
                  url: followingManagerEndpoint + "/my/followed(types=14)",  
                  headers: {   
                      "accept": "application/json;odata=verbose"  
                  },  
                  success: followedContentRetrieved,  
                  error: requestFailed  
            });  
         }  
         // Parse the JSON data and iterate through the collection.  
         function followedContentRetrieved(data) {  
             var stringData = JSON.stringify(data);  
             var jsonObject = JSON.parse(stringData);   
             var types = {  
               1: "document",  
               2: "site",  
               3: "tag"   
            };  
            var followedActors = jsonObject.d.Followed.results;   
            var followedList = "You're following items:";  
            for (var i = 0; i < followedActors.length; i++) {  
               var actor = followedActors[i];  
               followedList += "<p>The " + types[actor.ActorType] + ": \"" +actor.Name + "\"</p>"+"<p>Site URL " + ": \"" +  
               actor.Uri+ "\"</p>";;  
            }   
            $("#Follow").html(followedList);   
         }  
         function requestFailed(xhr, ajaxOptions, thrownError) {  
           alert('Error:\n' + xhr.status + '\n' + thrownError + '\n' + xhr.responseText);  
         }  
       </script>    
    </head>    
 <body>    
 <div id="Follow"></div>    
 </body>    
 </html>

Happy Coding :)

Best Recommended SharePoint 2013 Hosting

ASPHostPortal.com

ASPHostPortal.com is Perfect, suitable hosting plan for a starter in SharePoint. ASPHostPortal  the leading provider of Windows hosting and affordable SharePoint Hosting. ASPHostPortal proudly working to help grow the backbone of the Internet, the millions of individuals, families, micro-businesses, small business, and fledgling online businesses. ASPHostPortal has ability to support the latest Microsoft and ASP.NET technology, such as: WebMatrix, WebDeploy, Visual Studio 2015, .NET 5/ASP.NET 4.5.2, ASP.NET MVC 6.0/5.2, Silverlight 6 and Visual Studio Lightswitch, ASPHostPortal guarantees the highest quality product, top security, and unshakeable reliability, carefully chose high-quality servers, networking, and infrastructure equipment to ensure the utmost reliability

SharePoint 2013 Hosting – ASPHostPortal :: SharePoint 2013 Authorization and Authentication

OAuth in SharePoint 2013

In SharePoint 2010, the authentication to the site is based on Classic or Claims based or Anonymous Access but in SharePoint 2013, Microsoft come up with the new mode of Authentication called as €œOAuth€.

In case of SP sites, OAuth Process Flow is as follows

1. User Signs in SP 2013–>Security Token is generated by Identity Provider–>Token is validated & allows the user to Sign in SP sites.

OAuth is an open protocol for authorization. OAuth enables secure authorization from desktop and web applications in a simple and standard way. OAuth enables users to approve an application to act on their behalf without sharing their user name and password. For example, it enables users to share their private resources or data (contact list, documents, photos, videos and so on) that are stored on one site with another site, without users having to provide their credentials (typically user name and password).

OAuth enables users to authorize the service provider (in this case, SharePoint 2013) to provide tokens instead of credentials (for example, user name and password) to their data that is hosted by a given service provider (that is, SharePoint 2013). Each token grants access to a specific site (for example, a SharePoint document repository) for specific resources (for example, documents from a folder) and for a defined duration (for example, 30 minutes). This enables a user to grant a third-party site access to information that is stored with another service provider (in this case, SharePoint), without sharing their user name and password and without sharing all the data that they have on SharePoint.

2. When is using OAuth required?

The OAuth protocol is used to authenticate and authorize apps and services. The OAuth protocol is used:

- To authorize requests by an app for SharePoint to access SharePoint resources on behalf of a user.
- To authenticate apps in the Office Store, an app catalog, or a developer tenant.

3. Access Tokens

In SharePoint 2013, an OAuth STS is used only for issuing tokens (that is, server-to-server and context tokens). An OAuth STS is not used for issuing sign-in tokens, that is, they are not used as identity providers. So, you will not see an OAuth STS listed in the user sign-in page, the Authentication Provider section in Central Administration, or the people picker in SharePoint 2013.

But, SharePoint 2013 administrators can use Windows PowerShell commands to enable or disable an OAuth STS. SharePoint administrators are able to enable or disable OAuth for a given web application, similar to how they can enable or disable trusted login providers in SharePoint 2010.

SharePoint 2013 implements the OAuth protocol to allow apps that are running external to SharePoint to access protected SharePoint resources on behalf of a resource owner. In the SharePoint incoming implementation of the protocol, the OAuth roles are played by the following components:

External apps take on the role of the client.

SharePoint users take on the role of resource owner.

SharePoint 2013 takes on the role of the resource server.

ACS takes on the role of the authorization server.

4. Scope

An app for SharePoint requests permissions to access SharePoint resources by doing the following:

An app for SharePoint requests the permissions that it needs during installation from the user who is installing it.

The developer of an app must request, through the app manifest file, the permissions an app needs.

5. For an app to be granted the permissions it requested, the following conditions must be fulfilled:

An app must be granted permissions by the user who is installing it.

Users can grant only the permissions that they have; the user installing the app must be able to grant all permissions required by the app, or app installation fails.

6. An app is granted the permissions it asked for when:

An app is installed by a website administrator.

An app is explicitly granted permission by a tenant administrator or website administrator.

An end user gives consent.

In the app manifest file, an app requests access to specific scopes (that is, locations on SharePoint 2013). An app for SharePoint uses a permission request to specify the permissions that it needs to function correctly. The permission requests specify both the rights that an app needs and the scope at which they need the rights. In short:

An app uses permission request scopes to specify the permissions that it needs.

The requests specify both the rights and the scope that the app needs.

Scopes indicate where in the SharePoint hierarchy a permission request applies. SharePoint supports four different content scopes: site collection, website, list, and tenancy. There are also feature scopes for performing search queries, accessing taxonomy data, social features, Microsoft Business Connectivity Services (BCS) features, and Project Server 2013 features.

7. Steps in the SharePoint 2013

The OAuth authentication and authorization flow for a SharePoint 2013 cloud-hosted app is shown in Figure 1.

Figure 1

1. A user types a URL in a browser to go to a SharePoint page where a particular app is installed. In this case, the app is a Contoso.com app and the user interface element on the SharePoint page comes from the Contoso.com app.

2. SharePoint processes the page and detects that there is a component from the Contoso.com app on the page. SharePoint must get a context token that it can send to the Contoso.com app. SharePoint asks ACS to create and sign a context token that contains context information (for example, the current user, what web is being rendered on SharePoint, and other context information) and an authorization code. This context token can be used later by Contoso.com to request an access token from ACS. The Contoso.com server can use the access token to talk back to SharePoint if the Contoso.com app wants to make a web service call to SharePoint later.

3. ACS returns the signed context token to SharePoint. The signed context token is signed with an client secret that only ACS and the Contoso.com app share.

4. SharePoint renders the page, including an IFRAME pointing to the app host server in this case, Contoso.com. When SharePoint renders the page, it also passes the context token to the IFRAME.

5. The IFRAME causes the browser to request a page from the Contoso.com server. The context token is included in the browser request that is sent to the Contoso.com server.

6. The Contoso.com server gets the context token. Contoso.com validates the signature on the context token. The token is signed with an client secret that only Contoso.com and ACS share. Contoso.com can validate that the token is really intended for it and that it is not a random request from some random server. It knows that it is part of a SharePoint request.

7. If the Contoso.com server wants to talk back to SharePoint, there is a refresh token in the context token that Contoso.com can extract, so that it can include that information in the request to ACS for an access token. Contoso.com uses the refresh token that it extracted from the context token, the context token that it got from SharePoint, and its credentials (which are its client Id value and its client secret value) to request an access token from ACS so that it can talk back to SharePoint.

8. ACS returns an access token to the Contoso.com server. Contoso.com can cache this access token. That way, the Contoso.com server doesn’t have to ask ACS for an access token every time that it talks back to SharePoint. (Or, Contoso.com can make an access token request every time and not cache the access token.) By default, access tokens are good for a few hours at a time. Each access token is specific to the user account that is specified in the original request for authorization, and grants access only to the services that are specified in that request. Your app should store the access token securely, because it is required for all access to a user’s data.

9. Contoso.com can use the access token to make a web service call or CSOM request to SharePoint, passing the OAuth access token in the HTTP Authorizationheader.

10. SharePoint returns the information that Contoso.com requested to Contoso.com. The Contoso.com app renders the IFRAME contents as a per-user request in step 1. This completes the OAuth transaction process. The user now sees the SharePoint page fully rendered.

SharePoint 2013 Hosting with ASPHostPortal :: Tips SEO for Your SharePoint 2013 Site

As we may know that SharePoint 2013 has introduced many new features that more interesting than previous SharePoint. In this article, we will share how to optimize your SharePoint site. We are going to show you a few simple things you can do with your SharePoint Online website which will help you get started with your quest for the search rankings.

1. Use SEO Tools

This might sound obvious, but remember to use the tools that are provided. You don’t have to just jump straight into code to get started with your SEO. SharePoint Online Public website gives you a couple of tools to manage your Meta tags, as well as allowing you to choose custom URLs for pages.

Metadata

HTML Meta tags used to be the most recognized way to bump a page up in the search results page. Meta tags influence has been greatly reduced by most search engines, and they probably won’t help you increase your search ranking.

However, it has been suggested that leaving out Meta tags can negatively impact your search ranking. This means it’s still well worth adding Meta tags to the page; this is especially the case with your SharePoint Online Public website, as it has been made incredibly easy to add keywords to your pages.

To manage your Keywords, go to any page and select “Page” from the ribbon. From here, you can go to Edit Properties > Edit SEO Properties.

image-1

You can also manage site-wide Meta tags by going to Site Settings > Search engine optimization settings. This page lets you add Meta tags to the whole of your site.

In their example, it is useful for verifying your site for “Some Internet search engines” and their webmaster tools. You can then choose whether to actually use the Meta tags or not.

Page URLS

The URL of a page can sometimes play a significant role in the discoverability of a site. If a URL is kept short, simple and relevant, it makes it easier for both search engines to describe the content, and users to remember the link to get straight back to that content.

You can update any pages URL by navigating to the page, opening it edit mode, and clicking Edit Properties > Edit Navigation Properties

image-3

From here, you can select your new URL. This screen also lets you update how the page appears in your sites navigation.

You can also give it some descriptive text which will appear when you hover over it in the navigation. Again, it’s usually good to make this text descriptive, including keywords that are relevant to the destination page.

image-4

2. Change the Robots.txt File

The robots.txt file defines what content a search crawler is and is not allowed to index. This doesn’t mean that a user cannot get to that content, it just means that a search engine should never display that page when a user searches for your site.

You can get to this by going to Site Settings > Search Engine Sitemap Settings. SharePoint will have already set up a couple of the obvious one’s for you.

image-5

At this point, you can disallow any of the pages, or directories that you don’t want to be crawled. We’d recommend disallowing the crawling of any List pages, if that content is already being surfaced somewhere else on your site.

This is mainly because it’s of no use to your site visitors, but it could also potentially be seen as spam content. This is because it’s likely to be very keyword heavy, and also very similar (content wise) to the page that it is being surfaced on.

3. Create Simple Master Page

The default master pages that are provided on SharePoint Public Websites are the same master pages that are used for internal SharePoint sites.

This means that there is a lot of extra code in the master page which can mean sloppy HTML, and unnecessary file downloads. If you customise your master page, you can ensure that you have cleaner code, and make use of better Meta tags and micro formats to increase the machine readability of your site.

4. Check Your Documents

In many circumstances, the main content which a site is offering is actually stored in documents, and not in web pages. This content comes in forms of PDFs and Word documents to name but a few.

If you want this content to be indexed, you must think about how a search engine will find it. If you are just uploading a document to a document library, will it ever be read? There are 2 quick ways of improving the chances of somebody finding this document

Please follow this steps how to implement it:

The first way is to ensure your document names contain keywords describing the contents of the document. For example, the URL for a pdf uploaded to your documents library may look something like this: ‘/documents/blog-improve-sharepoint-site-seo.pdf’. This means that the content of the document is clear to both your site users and a search engine.

Our second tip to improve the way you offer documents, is to ensure that you are linking to your documents from other places in your site. This is a general rule for any type of site, however it is especially relevant for SharePoint 2013. Document libraries and Lists are often rendered with Client Side Rendering in SharePoint 2013.

What does this mean to SEO? When the page loads, none of the content from your document library is rendered as HTML. Instead, a large JavaScript object is created, and then transformed into HTML dynamically after the page has downloaded. This will mean that a search engine will not easily be able to read this list or library.

This can be seen if you look at the snippet that Google shows for some of your pages. Whilst we was writing this blog, we noticed that page with the Documents app on was displaying as : “javascript:commonShowModalDialog(‘{SiteUrl}’+ ‘/_layouts/15/itemexpiration.aspx’ +’?ID={ItemId}&List={ListId}’, ‘center:1;dialogHeight:500px”.

This is useless to a user, and does not inform them what this page is about. By following the tips above about Meta tags, this may prevent this from happening, however it will still not find the links to the document. Instead you should be linking directly to the document. When you do this, it’s also a good idea to set the text of the link to some keywords, rather than just “download” or something equally ambiguous.

So there’s our quick tips on improving the search rating of your SharePoint Online Public Site. There are probably a lot more things you can do to help improve it, and as Office 365 (2013) approaches General Availability, we hope to be adding some more details around the topics above in the near future.

SharePoint 2013 Hosting with ASPHostPortal :: Why You Must Use SharePoint 2013?

Previously, we wrote about the factors that makes difference between SharePoint 2013 with previous SharePoint. Now, we will discuss more about why you must use SharePoint 2013 for your business. SharePoint has seen widespread adoption across all types of organizations over last five years. SharePoint 2010 brought us some major changes (compared to MOSS 2007), and SharePoint 2013 continues that trend by introducing some new cutting edge features for web content management, workflow, search, and big data.

We have figured out some reasons why SharePoint 2013 is very interesting for your business.

Document ManagementSharePoint 2013 Search

In SharePoint 2013, SkyDrive Pro is a new attempt at taking your content offline and replace SharePoint Workspace. The experience of taking your documents offline has also been improved by simply clicking the sync button. This is much more of the “drop box” experience that I hear is massively being adopted for its ease of use in businesses.

User Interface

When you first see SharePoint 2013, you realize it is a significant change over what is now in SharePoint 2010. The main changes are the “less is more” theories being applied in cleaning up the interface. Getting rid of some of the SharePoint-nuances like “Site Actions” and replacing with settings cog icon, having the getting started “Modern UI” tiles being front and center – but more importantly removable – getting rid of the useless photo that survived both SharePoint 2007 and SharePoint 2010 in team site template! It feels like a more polished, ”user first” user interface.

Search

Search enables us to discover information quickly, and SharePoint 2013 enables me to find things much more quickly with quick document previews in the web browser, much better search refiners on the left-hand side, and subtle improvements like “view library” and “send”.

Web Content Management

Running internet facing sites on SharePoint has been around since MOSS 2007, but didn’t really mature in SharePoint 2010. With that said, it is clear that there is a great focus on this for SharePoint 2013. From a business productivity perspective, this not only benefits internet facing site authors, but also internal sites that want these advanced publishing features. Improvements in embedding video directly into pages, much shorter URLs, and the ability to have better multi-lingual and multi-device support means that your Intranet, Extranet will work much better!

Business Intelligence

Business Intelligence continues to evolve in SharePoint 2013 with improvements across the board in Excel client, Excel services, PerformancePoint services and Visio services. The in-memory capabilities of Excel client now allow business users to pull data from various sources and build amazing sheets in minutes.

Social

Facebook and Twitter are the kings of social and have been around for a long time, and with the release of SharePoint 2013 some of the user experiences have been introduced. For me, the biggest additions are the “@” symbol to lookup people to reference in social activity updates, the new communities with badges to gamify collaboration, and the ability to follow not only people but also documents, sites and tags. SharePoint 2010 was really missing the last piece to truly encourage users to adopt social and invest the time in social tagging.

Improved workflow

With SharePoint 2013, the old SharePoint 2010 engine is maintained as-is but a new add-on called “Workflow Manager” can be downloaded and installed separately.  Workflow Manager can run on its own server and has its own respective databases for the manager itself and the Service Bus.

Big data support

Support for big data has been added.  SharePoint 2013 allows for much larger data sets thanks to updated integrated PowerPivot technology.  Built on the Vertipaq engine, large data sets can be compressed and filter while in memory on the server, allowing operations on the data occur very fast.

The Power View data modeling and visualization engine for Excel has also be updated.  User can leverage Power View with large data sets to create visualizations with charts, graphs, runtime data filtering, and slicers.

 

For us, above point are top reasons why you must use SharePoint 2013. Have you try this newest SharePoint 2013? If not, you must try it on our SharePoint 2013 hosting environment with very affordable hosting plan

 

SharePoint 2013 Hosting with ASPHostPortal.com :: The Most Important Factors Between SharePoint 2013 and SharePoint 2010

SharePoint 2013 has many interesting feature that help you in organization. The platform is prompting a lot of interest, and there are some compelling reasons to make the move, according to an article from SharePoint Pro. What the interesting feature that improve in SharePoint 2013? In here we will describe the most difference between SharePoint 2013 with previous SharePoint 2010 and 2007.

Top Interesting Feature in SharePoint 2013

SearchSharePoint 2013

The integration of FAST Search Server capabilities into SharePoint 2013 represents a significant upgrade. Even better, it’s available out of the box with little to no configuration required. FAST provides a better search experience, which should lead to increased confidence in SharePoint’s search capabilities and better adoption.

User interface

The more modern user interface in SharePoint 2013 provides a nicer experience. It’s cleaner and easier to navigate compared to previous versions.

Cloud

Many see SharePoint 2013 as a stepping-stone to moving to a cloud-based collaboration solution.

Mobile

Mobile access is becoming an increasingly vital part of improving productivity.

Power users

SharePoint is increasingly standardized and gets continuously easier to use. That means there are now power users, often business process analysts, who want to use SharePoint and may go around IT to do so if necessary, according to the article.

If you compare with SharePoint 2010 and SharePoint 2007, then there will be quite differences feature. Many large organizations invested a significant amount of money into SharePoint 2010 and made many customizations. We also believe because that factors, there are many clients that migrate from SharePoint 2010 to SharePoint 2013.

Conclusion

Ready to try SharePoint 2013 feature? Find affordable SharePoint 2013 hosting with ASPHostPortal.com with just only $9.99/month. Please kindly check our site for more information