I'm attempting to retrieve the URL of the current document in a SharePoint 2010 document library so it can be added to an email in a SharePoint 2010 workflow.
Currently, I have the following code in a Utilities.cs file:
namespace WorkflowProject1.Workflow1
{
public static class Utilities
{
public static string AbsoluteUrl(this SPFile File)
{
string EncodedUrl = File.Item[SPBuiltInFieldId.EncodedAbsUrl].ToString();
string DecodedURL = SPEncode.UrlDecodeAsUrl(EncodedUrl);
return DecodedURL;
}
}
}
In my workflow file (Workflow1.cs) with the same namespace I am trying to call the above method using the following line:
Item.File.AbsoluteUrl();
When I attempt to call the method I get "the name Item does not exist in the current context". Am I missing a reference? Any suggestions on how to retrieve the DecodedURL value so I can use it in my main workflow file would be greatly appreciated. Also, most of this code was copied from another post but I do not have enough points to comment on the original post.