Article archive
Recursive function to go through folders
27/10/2012 14:09
SPWeb web = SPContext.Current.Web;
string folderUrl = SPUtility.ConcatUrls(web.Url, "Pages");
SPFolder folder = web.GetFolder(folderUrl);
...
Custom menu item with code behind
26/10/2012 12:39
Excellent article
https://www.codeproject.com/Articles/127421/SharePoint-2010-Site-Actions-Menu
xml version="1.0" encoding="utf-8"?>
<Elements...
Custom menu item in Site Action menu
26/10/2012 11:31
https://blogs.msdn.com/b/vssharepointtoolsblog/archive/2010/02/18/adding-actions-to-site-actions-menu.aspx
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="https://schemas.microsoft.com/sharepoint/">
<CustomAction
Id="ApproveMenuItem"
Description="Option to approve...
Add web part to the page
21/10/2012 15:10
Add web part to the page
$serverUrl="https://fastlanessl"
$assembly=[void][reflection.assembly]::LoadWithPartialName("Microsoft.SharePoint.Publishing, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c")
#you have to get the web, where you want to add the...
Get web part object with properties
21/10/2012 14:14
$serverUrl="https://fastlanessl"
$assembly=[void][reflection.assembly]::LoadWithPartialName("Microsoft.SharePoint.Publishing, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c")
#you have to get the web, where is your web part
$site = Get-SPSite...
Get list EventReceivers
21/10/2012 13:44
$serverUrl="https://fastlanessl"
$listName="ContactFinder Contacts"
#get List object
$spWeb = Get-SPWeb -Identity $serverUrl
$spList = $spWeb.Lists[$listName]
$spList.EventReceivers
Verify private method was called
20/10/2012 23:53
ClearCache(properties) is private static void function of ContactListReceiverClass
//Verify private static method was called
Isolate.Verify.NonPublic.WasCalled(typeof(ContactListReceiverClass),"ClearCache").WithArguments(properties);
//In case it's instance...
Test - call private method, or private static method
20/10/2012 21:55
//var underTest = new ContactListReceiverClass();
//Invoke normal method
var result = Isolate.Invoke.Method(underTest, "ClearCache", properties);
//Invoke static method
var result =...
HttpContext in SPItemEventReceiver
20/10/2012 21:01
//to get Current HttpContext insied of SPItemEventReceiver... (HttpContext.Current is always null as this is asynchronous event receiver)
HttpRequest request = new HttpRequest(string.Empty, properties.Web.Url,...
Expected Exception in Unit test
17/10/2012 16:36
//Exception in calling target (test itself)
[TestMethod, Isolated]
[ExpectedException(typeof(EmailNotSentException))]
public void ProcessWhenGenericExceptionIsThrownConvertItToEmailNotSentException()
{
Isolate.WhenCalled(() => SPUtility.SendEmail(null, true, false, address, subject,...
Items: 271 - 280 of 384