Monday, December 31, 2018

SharePoint 2016 Quick Edit View – This control is Currently Disabled


SharePoint 2016 Quick Edit View – This control is Currently Disabled

Hello Dear SharePoint-ers,
So I have been working on SharePoint 2016 having migrated from SharePoint 2010 and have been playing with the New REST API(s) and JQuery and PowerShell.
Today I want to discuss a unique issue I have come across and hope it will save your precious time Googling.
This issue is about “All Items“ view and quick edit not working or Disabled. Normally, you find that in List Settings/ Advance the Quick Edit View is enabled, but yet you cannot view the ALL Items view in Quick Edit.
Advanced Setting Quick Edit
To Fix this Issue.
1.       Go to your All Items View
2.       Go to Style. If it is Shaded as shown. Quick Edit will not work
3.       Make sure you change it to Default, and your quick edit should start working.
4.       Fully Functioning enabled control after the Style has been changed to Default. I hope this helps.Happy SharePointing

5.       Let me know if it works for you. Note I have found this issue only when the Style is SHADED. I have NOT Experimented with OTHER STYLES.

Thanks to Ed Keenan and Steve Grater who assisted is discovering this issue

Friday, October 3, 2014

Server Error in ‘/’ Application when you open Page layouts and site template from SharePoint 2010 site settings.



Server Error in ‘/’ Application when you open Page layouts and site template from SharePoint 2010 site settings.
Issue:
From Site settings Page layouts and site templates link above throws the error shown below:
The UI will display the following error
Fire off your ULS Viewer you will see the following

Notice these lines
at Microsoft.SharePoint.Publishing.PublishingWeb.get_DefaultPageLayout() 
at Microsoft.SharePoint.Publishing.Internal.CodeBehind.AreaTemplateSettingsPage.InitializeDefaultPageLayoutSection()  
Resolution
It means that that the default page layout could not be loaded. The  following powershell script code solved this issue for me.

Add-PSSNapin Microsoft.SharePoint.PowerShell
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Publishing")
$site = Get-SPSite http://yourserver
$publishingSite = New-Object Microsoft.SharePoint.Publishing.PublishingSite($site)
$publishingWeb = [Microsoft.SharePoint.Publishing.PublishingWeb]::GetPublishingWeb($site.RootWeb)
$pageLayout = $publishingWeb.GetAvailablePageLayouts() | ? { $_.Name -eq "BlankWebPartPage.aspx" }
$publishingWeb.SetDefaultPageLayout($pagelayout, $true)
$publishingWeb.Update()

Ref: http://www.justinkobel.com/post/2014/01/02/Error-in-SharePoint-Publishing-Sites-For-Default-Pages.aspx

I hope this will save you some valuable time.

Thursday, September 25, 2014

Power Shell Script to grant a group permission recursively in a SharePoint Library


My task today was to write a script to recursively grant this particular group "full permission" in this document library.Obviously this is a tedious task especially when you have lots of items.
So Power shell to the rescue. I hope someone out there can use it.




##
#Make Sure snapin is loaded
##

$ver = $host | select version
if($Ver.version.major -gt 1) {$Host.Runspace.ThreadOptions = "ReuseThread"}
if(!(Get-PSSnapin Microsoft.SharePoint.PowerShell -ea 0))
{
    Write-Progress -Activity "Loading Modules" -Status "Loading Microsoft.SharePoint.PowerShell"
    Add-PSSnapin Microsoft.SharePoint.PowerShell
}

#Here we want to give Full Control permission to SharePoint_SP_Team on all items this library recursively
$web = get-SPWeb("http://yourServerhere")
$list = $web.Lists
$PermissionLevel = "Full Control"
$GroupName = "SharePoint_SP_TEAM"
if ($list -ne $null)
{
    #Go through each Item and Change Permission
    foreach($RootItem in $list)
    {
        if($RootItem.Hidden -eq $False)
        { 
            if ($RootItem.HasUniqueRoleAssignments -eq $False)
            {
                $RootItem.BreakRoleInheritance($True)
            }

            if ($RootItem.HasUniqueRoleAssignments -eq $True)
            {
                ForEach ($SiteGroup in $web.SiteGroups)
                {                   

                    if ($SiteGroup.Name -match $GroupName)
                    {
                        write-host $SiteGroup.Name
                        $GroupName = $SiteGroup.Name
                        $roleAssignment = new-object Microsoft.SharePoint.SPRoleAssignment($SiteGroup)
                        $roleDefinition = $web.RoleDefinitions[$PermissionLevel];
                        $roleAssignment.RoleDefinitionBindings.Add($roleDefinition);
                        $RootItem.RoleAssignments.Add($roleAssignment)
                        $RootItem.Update();
                        write-host $RootItem.Title
                        Write-Host "Successfully added <$GroupName>" -foregroundcolor Green
                    }               
              
             }
            }
         }
    }
}


Wednesday, September 24, 2014

When Environment.Newline and “\r\n” fails to create a new line.



I had a unique situation where I needed to display some document links and I tried using both Environment.Newline and “\r\n” and none of these gave me the result I needed. Here is the situation below.

Document 1 = “Hello1.docx”
Document2 = “Hello2.pptx”
Document3 = “Hello3.xls”

All three documents reside in a document library with the following links

Document1 = https://YourServerName/SharedLibrary/ Hello1.docx
Document1 = https://YourServerName/SharedLibrary/ Hello2.pptx
Document1 = https://YourServerName/SharedLibrary/ Hello3.xls

Here is my html code to display them.
outHtml1 = @”<a class='static menu-item'target='_blank' href='https://YourServerName/SharedLibrary/Hello.docx'><span class='additional-background'><span class='menu-item-text'>Hello1 Doc</span></span></a><br />” + “\r\n”;

outHtml2 = @”<a class='static menu-item'target='_blank' href='https://YourServerName/SharedLibrary/Hello2.pptx'><span class='additional-background'><span class='menu-item-text'>Hello2 pptxc</span></span></a><br />” + + “\r\n”;

outHtml3 = @”<<a class='static menu-item'target='_blank' href='https://YourServerName/SharedLibrary/Hello3.xls'><span class='additional-background'><span class='menu-item-text'>Hello3 xls</span></span></a><br />” + “\r\n”;




        /// <summary>
        /// Get Aritifacts by GroupID
        /// </summary>
        /// <param name="list"></param>
        /// <returns></returns>
        ///
        private bool GetArtifactsByGroup(SPList list, string ValidationProcedure, string Classification, string Group, out string strNavigationURL, string webAbsoluteUrl, out string strGroups)
        {
            bool blnFound = false;
            string outNavUrl = string.Empty;
            string strGroupList = string.Empty;
            string outHtml = string.Empty;
            StringBuilder sb = new StringBuilder();
            try
            {

                SPSecurity.RunWithElevatedPrivileges(
                  delegate()
                  {

                      SPListItemCollection myList = null;
                      SPQuery qryGetArtifactsByGroup = new SPQuery();
                      qryGetArtifactsByGroup.ViewAttributes = "Scope=\"FilesOnly\"";
                      qryGetArtifactsByGroup.Query = string.Concat("<Where>",
                       "<And>",
                           "<And>",
                              "<Eq>",
                                 "<FieldRef Name='Validation_x0020_Procedure' />",
                                 "<Value Type='Lookup'>" + ValidationProcedure + "</Value>",
                                "</Eq>",
                              "<Eq>",
                                 "<FieldRef Name='Classification' />",
                                 "<Value Type='Choice'>" + Classification + "</Value>",
                             "</Eq>",
                           "</And>",
                           "<Eq>",
                              "<FieldRef Name='Group' />",
                              "<Value Type='Lookup'>" + Group + "</Value>",
                           "</Eq>",
                        "</And>",
                     "</Where>");

                      qryGetArtifactsByGroup.ViewAttributes = "Scope = 'Recursive'";
                      qryGetArtifactsByGroup.ViewFields = @"<FieldRef Name='Title' />
                                                                  <FieldRef Name='Name' />
                                                                  <FieldRef Name='Group' />
                                                                  <FieldRef Name='Validation_x0020_Procedure' />
                                                                  <FieldRef Name='Classification' />
                                                                  <FieldRef Name='FileRef' />
                                                                  <FieldRef Name='ContentType' />
                                                                  <FieldRef Name='DocumentID' />
                                                                  <FieldRef Name='Group_x003a_Groups' />
                                                                  <FieldRef Name='Group_x003a_ID' />
                                                                  <FieldRef Name='GroupID' />";
                      myList = list.GetItems(qryGetArtifactsByGroup);

                      if (myList != null && myList.Count > 0)
                      {
                          foreach (SPListItem item in myList)
                          {
                              strGroupList = string.Concat(TranslateLookup(item, "Group").Trim(), "\r\n");
                              outNavUrl = webAbsoluteUrl + string.Format("/{0}", SPEncode.UrlDecodeAsUrl(item.Url)).Trim();
                              outHtml += @"<a class='static menu-item' target='_blank'  href='" + outNavUrl + "'><span class='additional-background'><span class='menu-item-text'>" + item.Name + "</span></span></a>" + "\r\n";
                              sb.AppendLine("<a class='static menu-item'  target='_blank' href='" + outNavUrl + "'><span class='additional-background'><span class='menu-item-text'>" + item.Name + "</span></span></a>" + "<br />");
                              blnFound = true;
                          }

                      }
                  });

            }
            catch (Exception err)
            {
                DispayErrormessage(err);
            }
           
            strNavigationURL = sb.ToString();
            strGroups = strGroupList;
            return blnFound;
        }


From the code above, the outHtml did not provide the needed line break.
The StringBuilder, Sb.AppenLine gave me the needed linebreak. I hope this may help someone out there with the same issue.
This should have worked. But, it did not work for me. The actual result is shown below:

Thursday, September 4, 2014

SharePoint Designer Server Error: The attempted operation is prohibited because it exceeds the list view threshold enforced by the administrator



SharePoint Designer Server Error: The attempted operation is prohibited because it exceeds the list view threshold enforced by the administrator.




If you see the error below:


 

It means you have to change your Listview threshold as follows:

Change the List View Threshold option:

  1. Login to Central Admininstration;
  2. Go to Application Management -> Manage Web Applications;
  3. Select SharePoint Central Administration WebApplication;
  4. In the ribbon above, click General Settings. That will bring down a menu, from which you should pick Resource Throttling;
  5. Change the List View Threshold option 30000 and press OK;

This solved my issue. I hope it resolves yours too.