Article archive

Set custom display form for SharePoint list

20/07/2015 17:46
Set your custom application page url on content type and if your list uses this content type, form will be associated too. If trying to set this application page url to list property DefaultDisplayFormUrl, I got errors of SPForm file not foundAdd-PSSnapin microsoft.sharepoint.powershell -ea...

SharePoint Timer Job properties

25/06/2015 14:07
   //This code is used in override Execute() method in class inherited from SPJobDefinition   //read application settings from OWSTIMER.EXE.CONFIG in C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\BIN string siteUrl =...

Query date field

24/06/2015 15:52
Gets all pages created until today Add-PSSnapin microsoft.sharepoint.powershell -ea 0 $webUrl = "https://yourSitecollection" $listName = "Pages" $web = Get-SPWeb $webUrl $list = $web.Lists[$listName] $value = [DateTime]::Today $date = Get-Date $value -Format...

Query lookup field

23/06/2015 10:46
$web = get-spweb "https://yourcollectionurl"$list = $web.Lists["Your list name"]$lookupValue = 1$query = new-object microsoft.sharepoint.spquery;$query.Query = "<Where><Eq><FieldRef Name='yourLookupFieldInternalName' LookupId='True'/><Value Type='Lookup'>"+ $lookupValue...

Create custom NewForm programmatically

19/06/2015 16:58
public static string CreateNewForm(SPList list){ SPFolder rootFolder = list.RootFolder; SPWeb web = list.ParentWeb; string newFormUrl = string.Format("{0}/{1}/NewFormCustom.aspx", web.ServerRelativeUrl, rootFolder.Url); var newForm = web.GetFile(newFormUrl); if (newForm !=...

Create wiki page programatically

19/06/2015 11:11
This example creates wiki page on site collection created from Enterprise wiki templateAdd reference to Microsoft.SharePoint.PublishingSPWeb web = SPContext.Current.Web;string tit = "My code article 3";string articleTitle = string.Format("{0}.aspx", tit);PublishingWeb pWeb =...

Define web part properties in C#

18/06/2015 09:15
private const string WpPropertiesCategory = "My category";    [WebBrowsable(true)][WebDisplayName("Template File Name")][Category(WpPropertiesCategory)][Personalizable(PersonalizationScope.Shared)]public string ExcelTemplateFileName { get; set; }[WebBrowsable(true)][WebDisplayName("File...

Parse query string

17/06/2015 15:02
using System.Web;  string queryString = https://bla.com?a=1&b=3&source=jfkjdskfjsdkfjdksf; NameValueCollection qscoll = HttpUtility.ParseQueryString(queryString); string first = qscoll.Keys[0]; //https://bla.com?a string firstValue = qscoll[first]; //1 string...

Add content database access denied

09/06/2015 15:43
I was fighting with Access Denied error when creating Content Database from C# code of sharepoint context (Console application was working)I used code in elevated privileges, my web application pool account had following permissions- in SQL Server - public, dbcreator, sysadmin, securityadmin- was...

Enable Rating on sharepoint list by powershell

09/06/2015 10:28
To enable rating functionality on the sharepoint list, script adds two sharepoint rating columns to the list content type and view. However, if you check list settings/rating settings in UI, Enable Rating settings is still set to No, until you click the star icon in any list item. Then suddenly is...
Items: 71 - 80 of 384
<< 6 | 7 | 8 | 9 | 10 >>