string taskID = Convert.ToString(GetNextAvailableIdFromList(workflowProperties.Site, workflowProperties.TaskListId));
string constructURL = returnTaskUrl(taskID);
private string returnTaskUrl(string taskId)
{
string fulltaskUrl = string.Empty;
string htmlTaskLink = string.Empty;
try
{
//Use this to return the relevant URL's for use in e-mail of tasks.
string weburl = workflowProperties.WebUrl;
string taskUrl = "/_layouts/WrkTaskIP.aspx?List=";
string listId = workflowProperties.TaskListId.ToString();
fulltaskUrl = weburl + taskUrl + listId + "&ID=" + taskId;
htmlTaskLink = "here";
}
catch (System.Exception ex)
{
}
return htmlTaskLink;
}
public static int GetNextAvailableIdFromList(SPSite site, Guid listId)
{
int NextAvailableId = -1;
if (site.WebApplication.ContentDatabases.Count > 0)
{
string DBConnString = site.WebApplication.ContentDatabases[0].DatabaseConnectionString;
SqlConnection con = new SqlConnection(DBConnString);
try
{
con.Open();
SqlCommand com = con.CreateCommand();
com.CommandText = String.Format("select tp_NextAvailableId from AllLists where tp_ID = '{0}'", listId.ToString());
NextAvailableId = (int)com.ExecuteScalar();
}
finally
{
con.Close();
}
}
return NextAvailableId;
}
Subscribe to:
Post Comments (Atom)
Popular Posts
-
In this post we are going to get information of all the sharepoint user groups in which current user belongs using SPServices. Below i...
-
Hi Guys, In this post we are going to learn How to add Asset picker control to a SharePoint FORM/Page. Recently I came across a require...
-
Hi Guys, In this post we are going to list out the differences between Sandboxed and Farm based Solutions. Farm based Solutions: Farm s...
-
Hi Friends, In this post, we are going to learn how to generate a thumbnail/preview of any Document or Video or Image in SharePoint. ...
-
In this post we will see how to Programatically set the master page of a sharepoint site. And also make sure its subsites inherits the roo...
No comments:
Post a Comment