Wednesday, March 25, 2015

Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 8000401a.

While working with excel in one of my SharePoint site with excel, I got an error as “Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 8000401a” as shown the image below
















This is the issue related to permissions for excel application in the server. We can fix the issue by the steps below.

Open Component services by entering dcomcnfg in Run.

In Component Services navigate to Component Services->Computers->My Computer->DCOM Config->Microsoft Excel Application. Right click and select Properties option as shown below.





























Select “Identity” in top, “Which user account do you want...” section, select “This user” and enter the account having admin control on the machine.


In the security section, Under "Launch and Activation Permissions", Choose "Customize", Click "Edit" button, Add the everyone account and add all the Permissions as shown below.



Do the same thing in "Access Permissions" and "Configuration Permissions". Now we can run excel without errors. 

Hope this helps.





Saturday, March 21, 2015

Exception from hresult 0x800a03ec excel - Error ‘Microsoft Office Excel cannot access the file’ while accessing Microsoft Office 11.0 Object Library

We got this error with SharePoint 2007 farm custom coding. Code downloads all the list items to excel template. Generally we can see this error with rows updating in excel. But we haven’t changed anything from DEV to PROD. We have investigated the error in SharePoint logs and Event logs.
We are seeing the error as there are several possible reasons: 
·           The file name or path does not exist.
·           The file is being used by another program.
·           The workbook you are trying to save has the same name as a currently open workbook.
After checking the issue. We have found that there is the error with excel service. To fix that we have to create a folder.

If we are running in Windows Server 2008 64-bit/R2,
·           Navigate to C:\Windows\SysWOW64\config\systemprofile folder and create the following directory “Desktop”
If we are running in Windows Server 32-bit
·           Navigate to C:\Windows\System32\config\systemprofile\Desktop folder and create the following directory “Desktop”

If still you have the issue, you have to change the security setting to run excel application using following steps,

·           Start –> enter DCOMCNFG.exe to open Component Service
·           This will bring up the component services window, expand out "Console Root" -> "Computers" -> "DCOM Config"
·           Find "Microsoft Excel Application" in the list of components.
·           Right click on the entry and select "Properties"
·           Go to the "Identity" tab on the properties dialog.
·           Select "The interactive user."
·           Click the "OK" button.
·           Switch to the services console
·           Start the service automating Excel
·           Test you application again.


Enable Windows authentication in IIS if excel application in your site prompting for credentials.

Saturday, March 14, 2015

Get all the site collection with content DB details using powershell commands

As discussed earlier power shell commands are pretty powerful than SharePoint object model code. Some time we can't run SharePoint object model code in production environment like gathering site/server/DB details.

We can get sites and content DB details using following power shell commands 


$rootSite=New-Object Microsoft.SharePoint.SPSite("Web app URL")
$spWebApp = $rootSite.WebApplication 
foreach($site in $spWebApp.Sites) {
    
    write-output "$($site.RootWeb.Url) - $($site.ContentDatabase)"     
  
    $site.Dispose() 


Wednesday, March 11, 2015

Create explicit managed path for host named site collection using PowerShell commands

In SharePoint 2013, host-named site collections (HNSC) are all the rage. Host-named site collections give you the ability to provide completely different URLs for a site collection regardless of the web application URL hosting it.  For example, you might have a web application URL named http://sharepoint.mycompany.com and under it you have a collaboration site with a URL of http://collaborate.mycompany.com and an Intranet site namedhttp://intranet.mycompany.com.  This allows you to host multiple types of SharePoint sites together on a single web application which ultimately reduces the amount of resources your server farm needs for application pools.

Just like any site collection, you have to create a managed path for the URL you want.  We do this using New-SPManagedPath.  We can add explicit or wildcard inclusions just like you can for path-based site collections.  Wildcard is the default, if you want explicit, include the –explicit parameter.  We also need to add the –HostHeader parameter to indicate this is used with host-named site collections.  Here’s an example, where I created the business-solutions explicit path from our example above.

New-SPManagedPath "managed path name" -HostHeader –Explicit

This technically makes this managed path available on any host-named site collection.  If you want to see what managed paths have been created for host-named site collections, use Get-SPManagedPath with the –HostHeader command.

Get-SPManagedPath –HostHeader

Now, we need to create the site collection using New-SPSite.  It takes a few parameters but the important ones for this scenario is the URL we want for the new site collection and then –HostHeaderWebApplication to specify which web application hosts the new site collection.

New-SPSite “Site collection URL” –HostHeaderWebApplication “host web app URL” -Name "Site collection name" -OwnerAlias domain\user  -Template STS#0


SharePoint 2010 site accessing error - The server is busy now. Try again later

While accessing ee.ihess.com (SharePoint 2010) site, I got the error saying that “The server is busy now. Try again later” as shown the image below.


We can get this error when on the processes/services taking up the bulk of your server resources you can take different actions to reduce this overload (For example: recycling the timer service more often). We have the option to turn off HTTP throttling for an entire web application in Central Administration.
We can fix this error by using the steps below
  • Navigate to Central Admin > Application Management > Manage Web Applications. 
  • Select the problematic Web App > Select the down arrow next to General Settings and click Resource Throttling.

  • On the bottom of the window there will be an option to turn HTTP Request monitoring and Throttling Off. Click OK to save changes.