Tuesday, May 16, 2017

DateTime control "Sorry, this site hasn't been shared with you"

We developed custom web part for SharePoint 2013 using Visual Studio 2012.
In web part we used SharePoint Date Time control. For some user after clicking calendar image its showing " "Sorry, this site hasn't been shared with you". For some users its working fine, all users having same permission.
DatePickerFrameUrl="<%$SPUrl:~sitecollection/_layouts/15/iframe.aspx %>"

<SharePoint:DateTimeControl ID="dtStartdate" runat="server"
DateOnly="true" DatePickerFrameUrl="<%
$SPUrl:~sitecollection/_layouts/15/iframe.aspx %>" />

SharePoint 2013 : How to Change Site Logo Programmatically using PowerShell?

Changing the logo is a basic  when it comes to branding SharePoint 2013 sites.

If you have more site collection in SharePoint ,hundred of site collection with subsites , go with sharepoint Powershell script

Get-SPWebApplication "http://sharepoint.crescent.com" | Get-SPSite -Limit "All" | Get-SPWeb -Limit "All" |  foreach { $_.SiteLogoUrl=""; $_.update(); Write-host "Changing Logo for:"$_.Url;  }

How to change a logo across all sites/sub-sites and pages?

Add-PSSnapin Microsoft.SharePoint.PowerShell -erroraction SilentlyContinue 

$SiteURL = "http://Your-Site-Collection-URL" 
#Get the site collection
$Site = Get-SPSite $SiteURL #Iterate through each site in the site collection
 foreach($web in $Site.AllWebs)
 {
 #sharepoint change logo programmatically 
$web.SiteLogoUrl = "/relative-path-logo-file" 
$web.Update() 
}

This operation can be performed only on a computer that is joined to a server farm

 You need to update the web.config to show errors rather than giving the generic errors.  I typically use “RemoteOnly” I believe…
By the sounds of it, the user you used to install SharePoint doesn’t have the correct permissions on the database.
You should have a “farm” account and an “install” account.  
I typically have an “sp_admin” account which I use for general administration and installation.  Your farm account also has particular permissions.

Thursday, April 6, 2017

Listitem.Update vs ListItem.SystemUpdate


  • SPListItem.Update() is used to update all the values in SharePoint List Item including Modified Date, Modified By, Version fields

  • SPListItem.SystemUpdate() is used to update the values of the list item without modifying the Modified Date, Modified By and Version fields.

  • SPListItem.Update() . Event Receiver is fired in case if listitemupdated,listitemupdating  event is associated. 
  • SPListItem.SystemUpdate() Event Receiver won't be fired in case if list item updated, listitemupdating  event is associated