SharePoint 2010 Upgrade fails. CanUpgrade [Microsoft.SharePoint.Administration.SPIisWebSite] failed.

SharePoint 2010 CU update error: CanUpgrade [Microsoft.SharePoint.Administration.SPIisWebSite] failed.

https://social.msdn.microsoft.com/Forums/en-US/f6f30ede-b614-4773-be98-0c9fac29ca37/upgrade-session-failed-100-complete?forum=sharepointadmin

Steps to Resolve:
-----------------------------------

Open Central Admin - Manage Web Applications - Select web application - Click on Delete Drop Down (Do not click on Delete Button) - Select Remove SharePoint from IIS Web site - Click following drop down - Remove SharePoint from IIS - Select IIS web site and zone to remove - Check if you see any web site which is not present in IIS - If you see any web site which is not under IIS then just select that and remove it from SharePoint.

Note:- Follow above steps on all SharePoint web servers.

Once above steps are done you can again run the PSConfig upgrade wizard and it should be successfull.

Upgrade command: psconfig.exe -cmd upgrade -inplace b2b -wait -force

 

Error Message. The file has been modified by SHAREPOINT-system

I deployed a SharePoint feature that has an Event Receiver and ran into this error when trying to update the Today Column during a nightly batch run. The Error occured on random Document Libray items. So I did some research and found out that I needed to update the Event Receiver to run as Synchonous when Updating items. This solved the problem! By default Event Receivers run Asynchrounsly, which is not always ideal, especially in this situation.

To fix this problem just update the Element.xml file for the Event Receiver in question for the event type (Updating) you want to run as Synchronous as follows. Then redeploy. Be sure to Deactivate and Activate the site feature once it has been redeployed since it might not be used everywhere.

<Synchronization>Synchronous</Synchronization> under Elements -> Receivers -> Receiver tag

Also in my nightly batch job I used the following code to disable Events when Updating... The Using Code is further down the page.

//Disables Events when updating
using (var scope = new DisabledItemEventsScope())
{
SPList list = oWebsite.Lists["Code Rules"];
//This must be switched on, otherwise the Update method will throw an exception.
collWebsite[i].AllowUnsafeUpdates = true;

for (int k = list.Items.Count - 1; k >= 0; k--)
{
SPListItem item = list.Items[k];
//This only Works if the List Item was manually Updated before using a column called Today.
item.Properties["Today"] = DateTime.Now.Date.ToString(CultureInfo.InvariantCulture);

//SystemUpdate Updates without changing the Modified Time OR Modified By and DOES NOT make a New Version!
item.SystemUpdate(false);
}
collWebsite[i].AllowUnsafeUpdates = false;
}

        #region DisabledItemEventsScope
        /// <summary>
        /// Disabled item events scope
        /// </summary>
        /// <see cref="https://adrianhenke.wordpress.com/2010/01/29/disable-item-events-firing-during-item-update/"/>
        class DisabledItemEventsScope : SPItemEventReceiver, IDisposable
        {
            bool oldValue;

            public DisabledItemEventsScope()
            {
                this.oldValue = base.EventFiringEnabled;
                base.EventFiringEnabled = false;
            }

            #region IDisposable Members

            public void Dispose()
            {
                base.EventFiringEnabled = oldValue;
            }

            #endregion
        }
        #endregion DisabledItemEventsScope

Good Luck!

Error Opening List in Access “Export to database failed. To export a list, you must have a Microsoft SharePoint Foundation-compatible application.” – SharePoint

One of our Clients were experiencing an issue while Opening one of the SharePoint 2010 Lists in Access. They were essentially Clicking on one of the links “Open in Access” from List’s Ribbon that would result in the following error.

“Export to database failed. To export a list, you must have a Microsoft SharePoint Foundation-compatible application.” To resolve this Download and Install the below hotfix for 32-bit Office and then restart your computer.

http://support2.microsoft.com/hotfix/KBHotfix.aspx?kbnum=2553170&kbln=en-US  

The SharePoint 2010 User Code Host service terminated unexpectedly

In the event logs, I found out, that I have errors in system logs:

  • Event Id: 7031, 7034;
  • source: Service Control Manager;
  • details: The SharePoint 2010 User Code Host service terminated unexpectedly.

I found out, that service account that was running Sandbox code service needs to have access to performance counters on the server. So what you need to do is pretty simple, you need to grant service account access to counters and you can do it by adding service account as a member of local group Performace Monitor Users in Server Manger.

The machine-default permission settings do not grant Local Activation permission for the COM Server application with CLSID {000C101C-0000-0000-C000-000000000046} – SharePoint 2010

Thanks to https://sajiviswam.wordpress.com/2011/04/15/the-machine-default-permission-settings-do-not-grant-local-activation-permission-for-the-com-server-application-with-clsid-000c101c-0000-0000-c000-000000000046-sharepoint-2010/

This error is being logged into the System event logs in Event Viewer due to inadequate permission for the farm admin account on the DCOM component 000C101C-0000-0000-C000-000000000046. In order to change the permission settings, perform the following steps.

  1. Open Component Service by clicking Start > Administrative Tools > Component Services.
  2. Navigate and expand the node Component Services > Computers > My Computer > DCOM Config.
  3. Right Click the sub node “000C101C-0000-0000-C000-000000000046” and select “Properties”.
  4. On the Properties dialog box, select Security tab. In most cases you will notice that the settings are grayed out. This is because the logged in user doesn’t have enough permissions on this component to change the settings. In order to provide this permissions, perform the steps described in next section “Change Component Service Owner and Permission”. You may need to restart the server after doing this.
  5. Once you set up the permission mentioned in previous step, in the Launch and Activation Permissions section in Security tab, select Customize option and click Edit.
  6. In the popup window, add the farm admin user account and check Local Launch and Local Activation permissions.
  7. Restart IIS and SP Timer. If possible, restart the server itself.

Change Component Service Owner and Permission

In the DCOM Config dialog box, you noticed that the settings are grayed out. In order to enable those settings, perform the following registry modification.

  1. Open Registry Editor by typing “regedit.exe” in Start > Run.
  2. Navigate and select the key “[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\AppID\{000C101C-0000-0000-C000-000000000046}]”
  3. Right click and select Permissions.
  4. In the popup windows, click Advanced.
  5. In the Advanced Security Settings windows, select Owner tab and change the owner to Administrators. Click OK to close the window.
  6. In the Permissions screen, select Administrators and check Full Control. Click OK to close the screen.
  7. Close the registry editor.

Removing references to old / unused databases in SharePoint 2010

From this guys site: http://www.mysharepointadventures.com/2012/11/removing-references-to-old-unused-databases-in-sharepoint-2010/

Over time, as you create / remove service applications, there is a tendency for SharePoint to retain a list of databases that are no longer in use but still referenced in the SharePoint Config database. If you try to remove the database on the SQL server without first removing it from SharePoint, you will get an event logged periodically on your SharePoint Web Front End about being unable to find / access the missing database.

Solution

To remove the orphan databases / databases that are no longer in use.

Run SharePoint Management Shell

Run the command

Get-SPDatabase | fl name,id

Locate the database you wish to remove and copy its ID.
Run the command

$db = Get-SPDatabase (id)
$db.Delete()

Now type Get-SPDatabase again, you should see that the database(s) have been removed.

Renaming SharePoint 2010 Search Service Database Name

From this guys great Blog! http://blogs.technet.com/b/meamcs/archive/2012/10/23/renaming-sharepoint-2010-search-service-database-name.aspx

In this post I’m planning to walkthrough the practice of changing the SharePoint 2010 Search Service Database names as you might need it in the following scenarios:

  • Replacing the Search Service Application Databases Names that Includes GUID’s to a friendlier name.
  • The Database Admin in the Organization is planning to change the naming convention of all the Databases names in the Data Center.
  • If you are planning to move from one Farm to another that has a different Naming Convention.

You have many options to do this practice as shown in the below figure, but in this post I will walkthrough the preferred steps only to make it simple and clear:

 

 

Renaming Property & Crawl DBs using Central Administration:

Verify that the user account that is performing the procedure is a member of the Farm Administrators SharePoint group.

  1. In Central Administration, click Application Management.
  2. On the Application Management page, click Manage service applications.
  3. Click the name of the Search Service Application.
  4. On the Search Administration page, click Modify.
  5. On the Manage Search Topology page, the following three databases are listed: Administration, Crawl, and Property. You can point to renamed or moved Crawl or Property databases by using this procedure.
  6. Click the database that you want to change, and then click Edit Properties.
  7. In the Database Server text box, type the new server location if there is one; in the Database Name text box, type the new name for the database; and then click OK.
  8. On the Manage Search Topology page, click Apply Topology Changes.

 

Notes:

  • You cannot point to a renamed or moved Search Administration database by using Central Administration.
  • It might take several minutes for the changes to take effect.

 

Renaming Search Service Application Database using PowerShell:

Verify that you meet the following minimum requirements: See Add-SPShellAdmin.

  1. On the Start menu, click All Programs.
  2. Click Microsoft SharePoint 2010 Products.
  3. Click SharePoint 2010 Management Shell.
  4. At the Windows PowerShell command prompt, type the following commands:
    1.  
      • Point the Search Administration database to its new name or location.
$searchapp | Set-SPEnterpriseSearchServiceApplication -DatabaseName "<NewDbName>" -DatabaseServer "<NewServerName>" 

 

Where:

  1.  
    1.  
      •  
        • <NewDbName> is the name of the renamed database
      •  
        • <NewServerName> is the new database location
  2. Monitor whether the search instances have finished re-provisioning.
Do {write-host -NoNewline .;Sleep 10; $searchInstance = Get-SPEnterpriseSearchServiceInstance -Local} while ($searchInstance.Status -ne "Online")

 

Additional References:

  1. Rename FAST Search for SharePoint 2010 Databases
  2. Rename or  Move Service Application
  3. Change database (FAST Search Server 2010 for SharePoint)

Value does not fall within the expected range

I ran into a problem recently when looking up the Created By and Modified By fields for an List Item so I caould display it on an Application Page. When I opened the page it worked fine, however when a user with less privilages opened it they got an error laie this "Value does not fall within the expected range".

This is what I found and I have no idea why this was the solution BUT it worked for me.

http://blog.vanmeeuwen-online.nl/2012/07/value-does-not-fall-within-expected.html

Solution(s):
It seems there can be several causes.
1). Use of invalid field name. You need to use the internal field name! However, that was not the case in my situation.
2). Change the List View Lookup Threshold value of the web application. Default value is 8, I changed it to 20 and big surprise: it worked! Thanks to this post.
Note: My item has some lookup fields some of which some have more than 8 items.
Little conclusion: So it seems that when using (one of) the system admin accounts, this list view lookup threshold is ignored in one way. By using non-system admin accounts, it can be a show stopper.
Steps to edit this value:

  • Go to Central Administration > Application Management > Manage web applications
  • Select the appropriate web application (in my case the SharePoint - 80)
  • In the ribbon bar, select General Settings > Resourse Throttling
  • Search for the List View Lookup Threshold and change the value to 20.

Programmatically Setting a Page’s Title

I recently needed to change the Title of an Application Page in SharePoint 2010 from code behind. This is how I did it in Page_Load...

So the sequence goes:

  1. Get a reference to the appropriate Content Placeholder
  2. Clear out anything that SharePoint might have put in it already
  3. Put your content in.

Or, in C#:

ContentPlaceHolder contentPlaceHolder = (ContentPlaceHolder) Page.Master.FindControl("PlaceHolderPageTitle");

contentPlaceHolder.Controls.Clear();

LiteralControl literalControl = new LiteralControl();

literalControl.Text = "Your text goes here";

contentPlaceHolder.Controls.Add(literalControl);