- Lynne Harding
- Posts : 335
Join date : 2018-12-20
How do I connect Outlook Add-In to Mattersphere
Tue 4 Feb 2020 - 8:31
I have created an outlook add-in in Visual Studio and referenced various FWBS dlls.I am running the add-in in Outlook in the context of a Connected Mattersphere instance.I have a new button on a ribbon - I wish to perform various actions when clicking but I am getting an Object not referenced error message.How do I get my add-in to connect itself to the mattersphere session in Outlook.I have tried FWBS.OMS.Session.CurrentSession.Connect() but this does not work.Many thanks in advance
- Lynne Harding
- Posts : 335
Join date : 2018-12-20
Re: How do I connect Outlook Add-In to Mattersphere
Tue 4 Feb 2020 - 8:31
I think you need to use CurrentSession.LogOn instead and then if this throws an exception then try to connect after.
I hope this helps please find my logon code below
Thanks Phil
p.s. you will have to replace your DatabaseConnections info with the details you entered into the dbAPI table
private static void Logon(string DatabaseName, string Server)
{
try
{
Session.CurrentSession.APIConsumer = Assembly.GetExecutingAssembly();
var connections = new DatabaseConnections(“AssemblyName”, “Name”, “Version”);
DatabaseSettings settings = connections.CreateDatabaseSettings();
settings.DatabaseName = DatabaseName;
settings.LoginType = “NT”;
settings.Provider = “SQL”;
settings.Server = Server;
try
{
Session.CurrentSession.LogOn(settings, Environment.UserName, ““, true);
}
catch(Exception e)
{
Exception err = e;
try
{
Session.CurrentSession.Connect();
}
catch (Exception)
- Lynne Harding
- Posts : 335
Join date : 2018-12-20
Re: How do I connect Outlook Add-In to Mattersphere
Tue 4 Feb 2020 - 8:31
{
throw new MatterTransferException(“Connect Failed, error trying to log on”, err);
}
}
SpecialFolders.SetFolderPath(Environment.SpecialFolder.LocalApplicationData, “V:\\OMSCache\\”);
}
catch (UnauthorizedAccessException uae)
{
StringBuilder sb = new StringBuilder();
sb.Append(“Error Logging on with Domain user “);
sb.Append(Environment.UserDomainName);
sb.Append(@”\”);
sb.Append(Environment.UserName);
sb.Append(“, Matter Center Database: “);
sb.Append(DatabaseName);
throw new ApplicationException(sb.ToString(), uae);
}
catch (FWBSException fe)
{
throw new ApplicationException(“Error Logging on”, fe);
}
catch (Exception e)
{
throw new ApplicationException(“Error Logging on”, e);
}
}
throw new MatterTransferException(“Connect Failed, error trying to log on”, err);
}
}
SpecialFolders.SetFolderPath(Environment.SpecialFolder.LocalApplicationData, “V:\\OMSCache\\”);
}
catch (UnauthorizedAccessException uae)
{
StringBuilder sb = new StringBuilder();
sb.Append(“Error Logging on with Domain user “);
sb.Append(Environment.UserDomainName);
sb.Append(@”\”);
sb.Append(Environment.UserName);
sb.Append(“, Matter Center Database: “);
sb.Append(DatabaseName);
throw new ApplicationException(sb.ToString(), uae);
}
catch (FWBSException fe)
{
throw new ApplicationException(“Error Logging on”, fe);
}
catch (Exception e)
{
throw new ApplicationException(“Error Logging on”, e);
}
}
- Lynne Harding
- Posts : 335
Join date : 2018-12-20
Re: How do I connect Outlook Add-In to Mattersphere
Tue 4 Feb 2020 - 8:32
Thanks.
The only problem with this is that when Outlook opens it will be connected to Mattersphere already - so I just want it to use the current login details
/session that Outlook has used to connect to Mattersphere.
The only problem with this is that when Outlook opens it will be connected to Mattersphere already - so I just want it to use the current login details
/session that Outlook has used to connect to Mattersphere.
- Lynne Harding
- Posts : 335
Join date : 2018-12-20
Re: How do I connect Outlook Add-In to Mattersphere
Tue 4 Feb 2020 - 8:32
I'm sure someone will correct me if I'm wrong but I believe that is the different between Connect and Logon methods
Logon creates a new connection and Connect searches for existing connections for the username you pass it.
Logon creates a new connection and Connect searches for existing connections for the username you pass it.
Permissions in this forum:
You cannot reply to topics in this forum
|
|