Currently i'm doing something like this:
public string runSPGetEmailSmartObject(string userName, string connString)
{
string userMail = "";
string smartObjectName = "SPUser";
string smartObjectMethodName = "Read";
try
{
// create smart object server client to query smartobjects
SmartObjectClientServer soServer = new SmartObjectClientServer();
soServer.CreateConnection();
soServer.Connection.Open(connString);
//Instantiate SmartObject
SmartObject so = soServer.GetSmartObject(smartObjectName);
so.Properties["LoginName"].Value = userName;
so.MethodToExecute = smartObjectMethodName;
soServer.ExecuteScalar(so);
userMail = so.Properties["Email"].Value;
}
catch (Exception Ex)
{
Console.WriteLine(Ex.Message);
}
return userMail;
}
inside the workflow, which is identical to how I would do it if I was to call a SmartObject method from a standalone ASPX page.
Is there a more efficient way of doing this from inside a workflow code event. Currently i'm having to formulate a connection string which I feel I shouldn't need to create as the code runs in the context of the workflow.
any advice greatfully recieved
Martin.