Posts Tagged ‘SharePoint’

When running Enable-SPFeature, you may get the weird error:

“Enable-SPFeature : The file is currently checked out or locked for editing by another user.”


One possible cause of this issue could be that some file(s) the are deployed by the feature could be checked out by a user.

Checking the ULS logs you could find something like


Instantiating module “NAMEOFMODULE”: File could not be added at URL “FILENAME.jpg: Error 689225296 99e77593-d0d4-49df-adcc-c8f8251fbb82
04/06/2017 20:53:42.02 PowerShell.exe (0x107C) 0x1334 SharePoint Foundation Monitoring b4ly High Leaving Monitored Scope (SPSqlClient). Execution Time=11589.5652 99e77593-d0d4-49df-adcc-c8f8251fbb82
04/06/2017 20:53:42.02 PowerShell.exe (0x107C) 0x1334 SharePoint Foundation General 8kh7 High The file is currently checked out or locked for editing by another user.<nativehr>0x80070021</nativehr><nativestack></nativestack> 99e77593-d0d4-49df-adcc-c8f8251fbb82
04/06/2017 20:53:42.03 PowerShell.exe (0x107C) 0x1334 SharePoint Foundation General aix9j High SPRequest.EnableModuleFromXml: UserPrincipalName=i:0).w|s-1-5-21-995927836-1113283497-4239367599-17896, AppPrincipalName= ,bstrSetupDirectory=C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\Template ,bstrFeatureDirectory=Features\ABCDEP ,bstrUrl=,bstrXML=<Module Name=”images” Path=”Style Library\images” Url=”Style Library/images” RootWebOnly=”TRUE” xmlns=”http://schemas.microsoft.com/sharepoint/”><File ReplaceContent=”True” Type=”GhostableInLibrary” Path=”favicon.ico” Url=”favicon.ico” /><File ReplaceContent=”True” Type=”GhostableInLibrary” Path= ,fForceUnghost=False ,pModuleContext=<null> 99e77593-d0d4-49df-adcc-c8f8251fbb82
04/06/2017 20:53:42.03 PowerShell.exe (0x107C) 0x1334 SharePoint Foundation General ai1wu Medium System.Runtime.InteropServices.COMException: The file is currently checked out or locked for editing by another user.<nativehr>0x80070021</nativehr>

Read Full Post »


The list/library template you just created by saving List or library as a template is not showing up when you try to create a new list/library based on that template.


One thing to check first is to go to the List templates Gallery (Site settings-> List templates under web designer galleries).

If the template in question does NOT have product Version and Feature ID assigned. Then the problem might be that the ParserEnabled property is set to false on that site.



Using PowerShell , set the ParserEnabled property to true.

$web = Get-SPWeb <url of web>
$web.ParserEnabled = $true


Reference: https://support.microsoft.com/en-us/kb/2779729


Thanks to


Read Full Post »

Here is a simple script to create the site structure for SharePoint Online based on a csv file.

The script is using the Client-side SharePoint PowerShell project from Codeplex (https://sharepointpowershell.codeplex.com/ ).


In order to create the site structure just fill the csv file of the following format

Subsite1, SubSite1, STS#0, Name1, 1033
SubSite1/Subsite11, Name11, STS#0, Description, 1033
SubSite1/Subsite11/Subsite1111, Name3, STS#0, Description, 1033


And then use the following script


Import-Module "$PSScriptRoot\spps.psm1"
Import-Module "$PSScriptRoot\spps.subsites.psm1"
Import-Module "$PSScriptRoot\ConfigCredentials.ps1"

Initialize-SPPS -siteURL $O365SiteUrl -isOnline $true -onlineusername $username -onlinepassword $password

Import-Csv $PSScriptRoot\SiteStructure.csv  | ForEach-Object{

    $name = $_.Name
    $template = $_.Template
    $description = $_.Description
    $lang = $_.Language
    Write-Host "Processing " $name " "  $_.Url
    $relUrl = ""   
    foreach($subsite in $_.Url -split "/")
        $relUrl += "/"+ $subsite
            Open-Subsite -relativeUrl $relUrl
            Write-Host "Site" [$relUrl] "Already exists"
            Write-Host "Trying to create" $subsite
            Add-Subsite -title $name -url $subsite -webTemplate $template -language $lang -description $description
    Write-Host " ———————– "


Note, the Script ConfigCredentials.ps1 is used to store the Site Url and the credentials as follows

$O365SiteUrl = “https://url_here
$username = username@domain.com
$password = "password"


Note: to make sure the script behaves as expected, make sure that the hierarchy in the csv file is in order. i.e.


in other words do no list the sub site before its parent site.

Read Full Post »

For some reason if you set the Properties Hashtable of the File added as (“Title”, “TitleValue”), sharePoint just ignores it.


The Trick is to set the Title using (“vti_title”, “TitleValue”)

Read Full Post »

I had a custom web part that is running code that required elevated privileges and was running within SPSecurity.runWithElevatedPrivileges  as below




   SPSite siteColl = SPContext.Current.Site;



I kept throwing an access denied error.

after some investigation I found the solution at this useful blog.



the problem in short is, I was using a reference to the SPSite obtained from the SPContext. This reference to SPSite was created before the code entered the RunWithElevatedPrivileges block. Therefore, the reference to the SPSite was running under the current user privileges even though it was placed within the RunWithElevatedPrivileges block.


The solution is to obtain a new reference to the SPSite created within the RunWithElevatedPrivileges block as shown below.

    using (SPSite siteColl = new SPSite(SPContext.Current.Site.ID))


Read Full Post »

The new (just released) release of DotNetNuke  (enterprise edition) can now integrate with SharePoint to expose a document library on the internet. More at: http://www.dotnetnuke.com/Resources/Blogs/EntryId/3133/SharePoint-integration-in-DotNetNuke-6.aspx

Read Full Post »

Todd Carter posted a blog about the reason why SharePoint (MOSS 2007 and WSS 3.0) consume very large amounts of memory that could potentially cause memory loss. He also a quick workaround to fix it. This posted received thumbs up from many SharePoint gurus as a “must read”:


Read Full Post »

Older Posts »