You're almost there! Please answer a few more questions for access to the Applications content. Complete registration
Interested in joining? Complete your registration by providing Areas of Interest here. Register

How do I set an IGlobalContext variable

Accepted answer
7
Views
1
Comments
edited Jun 12, 2019 3:39PM in Integrations and APIs 1 comment

Content

Hello, 

I'm trying to get the below example code working,   I know _globalContext is of type IGlobalContext and I am declaring that, but how do I go about setting it initially?  I am trying to create a WorkspaceRibbonButton Add-In if that makes a difference.

Thank you

Version

18D

Code Snippet

EndpointAddress endPointAddr = new EndpointAddress(_globalContext.GetInterfaceServiceUrl(ConnectServiceType.Soap));
 
// Minimum required
BasicHttpBinding binding = new BasicHttpBinding(BasicHttpSecurityMode.TransportWithMessageCredential);
binding.Security.Message.ClientCredentialType = BasicHttpMessageCredentialType.UserName;
 
// Optional depending upon use cases
binding.MaxReceivedMessageSize = 1024 * 1024;
binding.MaxBufferSize = 1024 * 1024;
binding.MessageEncoding = WSMessageEncoding.Mtom;
 
// Create client proxy class
RightNowSyncPortClient client = new RightNowSyncPortClient(binding, endPointAddr);
             
// Ask the client to not send the timestamp
BindingElementCollection elements = client.Endpoint.Binding.CreateBindingElements();
elements.Find<SecurityBindingElement>().IncludeTimestamp = false;
client.Endpoint.Binding = new CustomBinding(elements);
 
// Ask the Add-In framework the handle the session logic
_globalContext.PrepareConnectSession(client.ChannelFactory);
 
// Go do what you need to do!
ClientInfoHeader cih = new ClientInfoHeader();
cih.AppID = "SAML Test";

Howdy, Stranger!

Log In

To view full details, sign in.

Register

Don't have an account? Click here to get started!