Posted by Scott on September 2, 2011
When creating CustomAction Elements, a number of tokens are available for use within the UrlAction Element in SharePoint 2010. The list of UrlAction tokens in SharePoint 2010 has grown ever so slightly (For a SharePoint 2007 reference, see UrlAction Tokens Of The CustomAction Feature).
Tokens
| Key |
| Available in 2007 |
| Available in 2010 |
Microsoft.SharePoint.SPCustomActionElement.ReplaceUrlTokens
internal static string ReplaceUrlTokens(string urlAction, SPWeb web, SPList list, SPListItem item)
{
if (string.IsNullOrEmpty(urlAction))
{
return urlAction;
}
if (item != null)
{
int d = item.ID;
string str1 = d.ToString(CultureInfo.InvariantCulture);
if (list.HasExternalDataSource)
{
str1 = item["BdcIdentity"] as string;
}
urlAction = urlAction.Replace("{ItemId}", str1);
urlAction = urlAction.Replace("{ItemUrl}", item.Url);
string recurrenceID = str1;
if (!string.IsNullOrEmpty(item.RecurrenceID))
{
recurrenceID = item.RecurrenceID;
}
urlAction = urlAction.Replace("{RecurrenceId}", recurrenceID);
}
if (web != null)
{
urlAction = urlAction.Replace("{SiteUrl}", web.Url);
}
if (list != null)
{
urlAction = "{ListId}".Replace(Guid guid = list.ID, guid.ToString("B"));
if (list.RootFolder != null)
{
urlAction = urlAction.Replace("{ListUrlDir}", list.RootFolder.Url);
}
}
HttpContext current = HttpContext.Current;
if (current != null && current.Request != null)
{
string rawUrl = current.Request.RawUrl;
Uri contextUri = SPAlternateUrl.ContextUri;
if (!string.IsNullOrEmpty(rawUrl) && null != contextUri)
{
string str2 = null;
if (!SPUtility.StsStartsWith(rawUrl, "/"))
{
str2 = string.Concat(contextUri.GetLeftPart(UriPartial.Authority), "/", rawUrl);
}
else
{
str2 = string.Concat(contextUri.GetLeftPart(UriPartial.Authority), rawUrl);
}
urlAction = urlAction.Replace("{Source}", SPHttpUtility.UrlKeyValueEncode(str2));
}
}
urlAction = SPUtility.GetServerRelativeUrlFromPrefixedUrl(urlAction);
return urlAction;
}
Reference
Posted by Scott on April 6, 2011
Microsoft just released an updated version of it’s guidance for Developing Applications for SharePoint 2010.
From Microsoft:
Developing Applications for SharePoint 2010 contains guidance documentation, detailed examples, and a reusable class library. These resources are designed to help solution developers and architects make the right decisions and follow proven practices when designing and developing applications for Microsoft® SharePoint® 2010. The guidance focuses on the building blocks that every developer needs to understand to become an effective SharePoint developer or architect.The guide is provided as a Help (.chm) file and has four core areas: application foundations, execution models, data models, and client models. Eight reference implementations illustrate the core concepts covered in the guide. The reusable class library provides code to help developers build more manageable, flexible, and testable applications. Source code is provided for all reference implementations and for the reusable library. The reference implementations have automated setup scripts to configure the applications.
Reference
Posted by Scott on December 31, 2008
Reza Alirezaei has a good post on the behind the scenes of CAS policies and SharePoint.
Check it out.