Monday, December 8, 2014

Sharepoint Search Results Page Configuration

Hi,

There would be certain requirement for certain customers like navigating to different search results pages from different pages.

Go the page and follow the below navigation

Site Actions->Edit Page->Search Box->Edit Web Part.

Here in web part Properties make sure that under Miscellaneous category below things have been done.

1)Use Site Level Defaults is unchecked.

2)Provide the search results page url in target Search Url field as below

Saturday, November 29, 2014

Go Home and Go Back functionlaity on SharePoint Search Results Page

Hi,

There was a requirement of Go Back and Go Home functionality on the SharePoint search  results page.

Because once user is redirected to share point search results page user should have certain option to go back to previous page/going back to home page.

To achieve this I have added a content editor web part on search results page through below navigation.

Site Actions->Edit Page->Click on Add a web part->Media and Content->Content Editor web part->Click here to add new content.

Post this clicking on Edit HTML Source on the ribbon.

I have pasted the below html to achieve the functionality
First we have used history.go(-1) in ‘Go Back’ functionality.

But problem with this is it works only in IE browser, didn't work in chrome/Firefox browser.

Monday, November 24, 2014

SPSecurityContext.WindowsIdentity: Could not retrieve a valid windows identity for NTName='domain\username', UPN='username@domain.com'. UPN is required when Kerberos constrained delegation is used.

Hi,

We were getting the below error when we were trying to save the wiki page through SharePoint ribbon.

Error:

SPSecurityContext.WindowsIdentity: Could not retrieve a valid windows identity for NTName='domain\username', UPN='username@domain.com'. UPN is required when Kerberos constrained delegation is used.  

Finally our teammate has found the solution i.e.

In the page layout that we were using we had commented the below table due to certain changes.
At the same time we had commented the table where we were referring to, there it started creating a problem.
Now had uncommented the area and changes as display property to none as below


Sunday, November 2, 2014

Default CheckBox Visibility

Hi,

Earlier behavior on our application was

Once user hovers on list view web part he was able to select the files to download.

But there was change request i.e. by default once user navigates to the page, should be able to see the checkbox to select the file.

For this we have modified the style as below


Friday, August 29, 2014

Update Handlers Section in Web Config through PowerShell

Hi,

There was a requirement of updating our timer job config with the below values in app settings section.
Post that we are referring the values in our web part.

<add name="HttpHandler.Layouts.HttpHandler.MyCustomHandlerDocx" verb="*" path="*.docx" type="HttpHandler.Layouts.HttpHandler.MyCustomHandler, HttpHandler, Version=1.0.0.0, Culture=neutral, PublicKeyToken= 6a49ec3306142af9" resourceType="Unspecified" />
      <add name="HttpHandler.Layouts.HttpHandler.MyCustomHandlerDoc" verb="*" path="*.doc" type="HttpHandler.Layouts.HttpHandler.MyCustomHandler, HttpHandler, Version=1.0.0.0, Culture=neutral, PublicKeyToken= 6a49ec3306142af9" resourceType="Unspecified" />
      <add name="HttpHandler.Layouts.HttpHandler.MyCustomHandlerPPTX" verb="*" path="*.pptx" type="HttpHandler.Layouts.HttpHandler.MyCustomHandler, HttpHandler, Version=1.0.0.0, Culture=neutral, PublicKeyToken= 6a49ec3306142af9" resourceType="Unspecified" />
      <add name="HttpHandler.Layouts.HttpHandler.MyCustomHandlerPPT" verb="*" path="*.ppt" type="HttpHandler.Layouts.HttpHandler.MyCustomHandler, HttpHandler, Version=1.0.0.0, Culture=neutral, PublicKeyToken= 6a49ec3306142af9" resourceType="Unspecified" />
      <add name="HttpHandler.Layouts.HttpHandler.MyCustomHandlerXLSX" verb="*" path="*.xlsx" type="HttpHandler.Layouts.HttpHandler.MyCustomHandler, HttpHandler, Version=1.0.0.0, Culture=neutral, PublicKeyToken= 6a49ec3306142af9" resourceType="Unspecified" />
      <add name="HttpHandler.Layouts.HttpHandler.MyCustomHandlerXLS" verb="*" path="*.xls" type="HttpHandler.Layouts.HttpHandler.MyCustomHandler, HttpHandler, Version=1.0.0.0, Culture=neutral, PublicKeyToken= 6a49ec3306142af9" resourceType="Unspecified" />
      <add name="HttpHandler.Layouts.HttpHandler.MyCustomHandlerPDF" verb="*" path="*.pdf" type="HttpHandler.Layouts.HttpHandler.MyCustomHandler, HttpHandler, Version=1.0.0.0, Culture=neutral, PublicKeyToken= 6a49ec3306142af9" resourceType="Unspecified" />
      <add name="HttpHandler.Layouts.HttpHandler.MyCustomHandlerJPG" verb="*" path="*.jpg" type="HttpHandler.Layouts.HttpHandler.MyCustomHandler, HttpHandler, Version=1.0.0.0, Culture=neutral, PublicKeyToken= 6a49ec3306142af9" resourceType="Unspecified" />

Now for these entries we had created the below PowerShell script

if ((Get-PSSnapin -Name Microsoft.SharePoint.Powershell -ErrorAction SilentlyContinue) -eq $null )
{
            Add-PSSnapin Microsoft.SharePoint.Powershell
}
Write-Host "Entered???"
$WebAppConfigPath = "C:\inetpub\wwwroot\wss\VirtualDirectories\80\web.config"
Write-Host "Loading Web.Config as XML in " $WebAppConfigPath -ForegroundColor Cyan
[xml]$xml = Get-Content $WebAppConfigPath
Write-Host "Started" -ForegroundColor Green
$handlersNode =$xml.SelectSingleNode("//configuration/system.webServer/handlers")

if ($handlersNode -eq $null)
{
Write-Host "Inside if loop" -ForegroundColor Green
$addhandlersNode=$xml.CreateNode('element',"handlers","")
$handlersNode=$xml.SelectSingleNode("//configuration/system.webServer").AppendChild($addhandlersNode)

}

##region to add entries into Handlers section.
function AddFileFormats()
{
try
{
$config1=$xml.CreateNode('element',"add","")
$config1.SetAttribute('name','HttpHandler.Layouts.HttpHandler.MyCustomHandlerDocx')
$config1.SetAttribute('verb','*')
$config1.SetAttribute('path','*.docx')
$config1.SetAttribute('type','HttpHandler.Layouts.HttpHandler.MyCustomHandler, HttpHandler, Version=1.0.0.0, Culture=neutral, PublicKeyToken= 6a49ec3306142af9')
$config1.SetAttribute('resourceType','Unspecified')

$config2=$xml.CreateNode('element',"add","")
$config2.SetAttribute('name','HttpHandler.Layouts.HttpHandler.MyCustomHandlerDoc')
$config2.SetAttribute('verb','*')
$config2.SetAttribute('path','*.doc')
$config2.SetAttribute('type','HttpHandler.Layouts.HttpHandler.MyCustomHandler, HttpHandler, Version=1.0.0.0, Culture=neutral, PublicKeyToken= 6a49ec3306142af9')
$config2.SetAttribute('resourceType','Unspecified')

$config3=$xml.CreateNode('element',"add","")
$config3.SetAttribute('name','HttpHandler.Layouts.HttpHandler.MyCustomHandlerPPTX')
$config3.SetAttribute('verb','*')
$config3.SetAttribute('path','*.pptx')
$config3.SetAttribute('type','HttpHandler.Layouts.HttpHandler.MyCustomHandler, HttpHandler, Version=1.0.0.0, Culture=neutral, PublicKeyToken= 6a49ec3306142af9')
$config3.SetAttribute('resourceType','Unspecified')

$config4=$xml.CreateNode('element',"add","")
$config4.SetAttribute('name','HttpHandler.Layouts.HttpHandler.MyCustomHandlerPPT')
$config4.SetAttribute('verb','*')
$config4.SetAttribute('path','*.ppt')
$config4.SetAttribute('type','HttpHandler.Layouts.HttpHandler.MyCustomHandler, HttpHandler, Version=1.0.0.0, Culture=neutral, PublicKeyToken= 6a49ec3306142af9')
$config4.SetAttribute('resourceType','Unspecified')

$config5=$xml.CreateNode('element',"add","")
$config5.SetAttribute('name','HttpHandler.Layouts.HttpHandler.MyCustomHandlerXLSX')
$config5.SetAttribute('verb','*')
$config5.SetAttribute('path','*.xlsx')
$config5.SetAttribute('type','HttpHandler.Layouts.HttpHandler.MyCustomHandler, HttpHandler, Version=1.0.0.0, Culture=neutral, PublicKeyToken= 6a49ec3306142af9')
$config5.SetAttribute('resourceType','Unspecified')

$config6=$xml.CreateNode('element',"add","")
$config6.SetAttribute('name','HttpHandler.Layouts.HttpHandler.MyCustomHandlerXLS')
$config6.SetAttribute('verb','*')
$config6.SetAttribute('path','*.xls')
$config6.SetAttribute('type','HttpHandler.Layouts.HttpHandler.MyCustomHandler, HttpHandler, Version=1.0.0.0, Culture=neutral, PublicKeyToken= 6a49ec3306142af9')
$config6.SetAttribute('resourceType','Unspecified')

$config7=$xml.CreateNode('element',"add","")
$config7.SetAttribute('name','HttpHandler.Layouts.HttpHandler.MyCustomHandlerPDF')
$config7.SetAttribute('verb','*')
$config7.SetAttribute('path','*.pdf')
$config7.SetAttribute('type','HttpHandler.Layouts.HttpHandler.MyCustomHandler, HttpHandler, Version=1.0.0.0, Culture=neutral, PublicKeyToken= 6a49ec3306142af9')
$config7.SetAttribute('resourceType','Unspecified')

$config8=$xml.CreateNode('element',"add","")
$config8.SetAttribute('name','HttpHandler.Layouts.HttpHandler.MyCustomHandlerJPG')
$config8.SetAttribute('verb','*')
$config8.SetAttribute('path','*.jpg')
$config8.SetAttribute('type','HttpHandler.Layouts.HttpHandler.MyCustomHandler, HttpHandler, Version=1.0.0.0, Culture=neutral, PublicKeyToken= 6a49ec3306142af9')
$config8.SetAttribute('resourceType','Unspecified')
$handlersNode.AppendChild($config1)
$handlersNode.AppendChild($config2)
$handlersNode.AppendChild($config3)
$handlersNode.AppendChild($config4)
$handlersNode.AppendChild($config5)
$handlersNode.AppendChild($config6)
$handlersNode.AppendChild($config7)
$handlersNode.AppendChild($config8)
$xml.Save($WebAppConfigPath)
Write-Host "Completed" -ForegroundColor Green
}
catch
{
   Write-Output $_
}

}AddFileFormats
#EndRegion
Finally it is inserting the values as below

Update Web Config through PowerShell

Hi,

There was a requirement of updating our timer job config with the below values in app settings section.
Post that we are picking the values from our web part.

<add key="NucleusSiteURL" value="https://oabc.com/sites/Nucleus" />
    <add key="NucleusSalesWorkShopLibrary" value="SalesWorkShop" />
    <add key="NucleusWikiSiteURL" value="https://oabc.com/sites/Nucleus/WikiSite" />
    <add key="NucleusPagesLibrary" value="Pages" />
    <add key="NucleusRFIRFPFAQ" value="RFI / RFP FAQs" />

Now for these entries we had created the below PowerShell script

if ((Get-PSSnapin -Name Microsoft.SharePoint.Powershell -ErrorAction SilentlyContinue) -eq $null )
{
            Add-PSSnapin Microsoft.SharePoint.Powershell
}
Write-Host "Entered???"
$WebAppConfigPath = "C:\inetpub\wwwroot\wss\VirtualDirectories\80\web.config"
Write-Host "Loading Web.Config as XML in " $WebAppConfigPath -ForegroundColor Cyan
[xml]$xml = Get-Content $WebAppConfigPath
Write-Host "Started" -ForegroundColor Green
$appSettingNode =$xml.SelectSingleNode("//configuration/appSettings")
if ($appSettingNode -eq $null)
    {
    Write-Host "Inside if loop" -ForegroundColor Green
                $addAppsettingNode=$xml.CreateNode('element',"appSettings","")
    $appSettingNode=$xml.SelectSingleNode("//configuration").AppendChild($addAppsettingNode)
    #$addAppsettingNode=$xml.SelectSingleNode("//configuration").AppendChild($addAppsetting)
    }
    else
    {
     Write-Host "Inside else loop" -ForegroundColor Green
    #$appSettingNode=$xml.SelectSingleNode("//configuration/appSettings").AppendChild($addAppsetting)
    }


$config1=$xml.CreateNode('element',"add","")
$config1.SetAttribute('key','NucleusSiteURL')
$config1.SetAttribute('value','https://oabc.com/sites/Nucleus')

$config2=$xml.CreateNode('element',"add","")
$config2.SetAttribute('key','NucleusSalesWorkShopLibrary')
$config2.SetAttribute('value','SalesWorkShop')

$config3=$xml.CreateNode('element',"add","")
$config3.SetAttribute('key','NucleusWikiSiteURL')
$config3.SetAttribute('value','https://oabc.com/sites/Nucleus/WikiSite')

$config4=$xml.CreateNode('element',"add","")
$config4.SetAttribute('key','NucleusPagesLibrary')
$config4.SetAttribute('value','Pages')

$config5=$xml.CreateNode('element',"add","")
$config5.SetAttribute('key','NucleusRFIRFPFAQ')
$config5.SetAttribute('value','RFI / RFP FAQs')

$appSettingNode.AppendChild($config1)
$appSettingNode.AppendChild($config2)
$appSettingNode.AppendChild($config3)
$appSettingNode.AppendChild($config4)
$appSettingNode.AppendChild($config5)

$xml.Save($WebAppConfigPath)
Write-Host "Completed" -ForegroundColor Green
Finally it is inserting the values as below

Update Timer Job Config through PowerShell

Hi,

There was a requirement of updating our timer job config with the below values in app settings section.
Post that we are picking the values from here into our custom timer job.

    <add key="NucleusSiteURL" value="https://oabc.com/sites/Nucleus" />
    <add key="NuclesuSalesTools" value="Sales%20WorkShop" />
    <add key="NucleusPathOfLearnFolder" value="SalesWorkShop/Learn/Verticals/" />
    <add key="NucleusPathOfPresentFolder" value="SalesWorkShop/Present/Verticals/" />
    <add key="NucleusPathOfSendFolder" value="SalesWorkShop/Send/Verticals/" />
    <add key="NucleusNumberOfDays" value="0" />

Now for these entries we had created the below PowerShell script

Add-PSSnapin "Microsoft.SharePoint.PowerShell"
Write-Host "Entered???"
$WebAppConfigPath = "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\BIN\OWSTIMER.EXE.CONFIG"
Write-Host "Loading Web.Config as XML in " $WebAppConfigPath -ForegroundColor Cyan
[xml]$xml = Get-Content $WebAppConfigPath
Write-Host "Started" -ForegroundColor Green
$appSettingNode =$xml.SelectSingleNode("//configuration/appSettings")
if ($appSettingNode -eq $null)
    {
    Write-Host "Inside if loop" -ForegroundColor Green
                $addAppsettingNode=$xml.CreateNode('element',"appSettings","")
    $appSettingNode=$xml.SelectSingleNode("//configuration").AppendChild($addAppsettingNode)
    #$addAppsettingNode=$xml.SelectSingleNode("//configuration").AppendChild($addAppsetting)
    }
    else
    {
     Write-Host "Inside else loop" -ForegroundColor Green
    #$appSettingNode=$xml.SelectSingleNode("//configuration/appSettings").AppendChild($addAppsetting)
    }

$config1=$xml.CreateNode('element',"add","")
$config1.SetAttribute('key','NucleusSiteURL')
$config1.SetAttribute('value','https://ophqa.mindtree.com/sites/Nucleus')
$config2=$xml.CreateNode('element',"add","")
$config2.SetAttribute('key','NuclesuSalesTools')
$config2.SetAttribute('value','Sales%20WorkShop')
$config3=$xml.CreateNode('element',"add","")
$config3.SetAttribute('key','NucleusPathOfMainFolder')
$config3.SetAttribute('value','SalesWorkShop/Learn/Verticals')
$config4=$xml.CreateNode('element',"add","")
$config4.SetAttribute('key','NucleusNumberOfDays')
$config4.SetAttribute('value','0')
$config5=$xml.CreateNode('element',"add","")
$config5.SetAttribute('key','NucleusEmailConfigurationList')
$config5.SetAttribute('value','EmailConfigurationList')
$config6=$xml.CreateNode('element',"add","")
$config6.SetAttribute('key','NucleusNumberOfMinutes')
$config6.SetAttribute('value','5')
$appSettingNode.AppendChild($config1)
$appSettingNode.AppendChild($config2)
$appSettingNode.AppendChild($config3)
$appSettingNode.AppendChild($config4)
$appSettingNode.AppendChild($config5)
$appSettingNode.AppendChild($config6)
$xml.Save($WebAppConfigPath)
Write-Host "Completed" -ForegroundColor Green

Finally it is inserting the values as below

Disabling Button to the Group Users

Hi,

There was requirement to our customer i.e.

For a specific SharePoint group, button Create Sub Folder should be disabled that has been created through customization.
For this, below is code that has been written in a method, that method has been called on the Page Load event of web part.

Validating Non Mandatory column

Hi,

Generally, if it is not mandatory column we can validate the same through out of the box.

But through one of my colleague I got to know the way by writing the formula i.e.
Navigate to the list->List Settings->Click on the column name ‘dept’
There under column name, formula has been applied as below
Now without selecting any value in the dept column when we try to save the value we shall be getting the validation message as below

This works out only when we try to add the new item in the list.
But when we try to edit the existing values this would not be applicable.

Folder View through List View Web Part

Hi,
We had a requirement of Pages library data in the form of Folder view that is only 2 folders alone i.e. Enabling Functions and General folder.
For this, a view has been created in the Pages library and below filter has been applied.
After adding the Pages library through list view web part, view has been applied through web part settings.
Finally the folder view is as below