CRM 2011 Visual Ribbon Editor – IFD / ADFS Support

I’ve been spending a lot of time with the CRM ribbon lately. This tool seemed really useful (CRM Visual Ribbon Editor).

Unfortunately it wouldn’t work with our third-party IFD / ADFS CRM provider. I grabbed the source and managed to get it working.

I had to make the following changes…

Please note the relevant line numbers in the syntax highlighter

Connection.cs

public bool ADFSMode {get; set;}
XElement adfsElement = new XElement("ADFSMode");
adfsElement.SetValue(ADFSMode);
c.Add(adfsElement);
var adfs = c.Element("ADFSMode");
if(adfs.Value.ToString() == "ADFS") {
  ADFSMode = true;
}
if(this.ADFSMode) {
  ClientCredentials credentials = new ClientCredentials();
  credentials.Windows.ClientCredential = CredentialCache.DefaultNetworkCredentials;
  credentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Impersonation;
  credentials.UserName.UserName = this.Login;
  credentials.UserName.Password = this.Password;
  service = new OrganizationServiceProxy(serviceUrl, null, credentials, null);
} else {
  // This is an existing line...
  service = new OrganizationServiceProxy(serviceUrl, null, creds, null);
}

ConnectionDialog.xaml

DesignHeight="280"
<CheckBox Grid.Row="5" Grid.Column="2" Name="ADFSMode" Margin="4" Content="ADFS / IFD Mode" />

ConnectionDialog.xaml.cs

c.ADFSMode = (bool)this.ADFSMode.IsChecked;

RibbonButton.xaml.cs

if(Connection.CurrentConnection.ADFSMode) {
  string actualURL = Connection.CurrentConnection.ServerUrl;
  if(actualURL.EndsWith("/")) { actualURL = actualURL.Substring(0, actualURL.Length - 1); }
  actualURL += relativeUrl;
  return actualURL;
}

It works and seems publishes changes correctly although I’ve only tried a few changes so far.

Hope this helps someone out.

Advertisements
Leave a comment

5 Comments

  1. Theres a new ribbon editor that’s been developed as a solution so it sits inside Dynamics CRM so it works with all deployment types & provides much more functionality as well.

    http://www.develop1.net/public/post/Moving-towards-Version-10.aspx

    Reply
  2. OK thanks – I’ll check that out.

    Reply
  3. Can you please send the working Ribbon editor to me, I am stuck with the same issue and unable to connect CRM IFD. Please send the binaries at email jeevan264@gmail.com.

    Reply
  4. I have done the above changes and am able to connect to IFD CRM. But I am getting the below error when it is trying to load the ribbon for an entity. Please help.

    Exception: FaultException`1

    Message: Attempting to select a readonly publisher for solution.

    StackTrace: Server stack trace: at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc) at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout) at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation) at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
    Exception rethrown at [0]: at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) at Microsoft.Xrm.Sdk.IOrganizationService.Create(Entity entity) at Microsoft.Xrm.Sdk.Client.OrganizationServiceProxy.CreateCore(Entity entity) at Microsoft.Xrm.Sdk.Client.OrganizationServiceProxy.Create(Entity entity) at VisualRibbonEditor.ServiceWrapper.CreateAsync(Entity entity, Action`1 callback) in D:\Documents and Settings\Office\My Documents\Downloads\crmvisualribbonedit-10810\VisualRibbonEditor\ServiceWrapper.cs:line 30 at VisualRibbonEditor.Solution.CreateSolutionThenAddEntityAndExport(Entity publisher) in D:\Documents and Settings\Office\My Documents\Downloads\crmvisualribbonedit-10810\VisualRibbonEditor\Solution.cs:line 386 at VisualRibbonEditor.Helpers.c__DisplayClass1.b__0(EntityCollection ec) in D:\Documents and Settings\Office\My Documents\Downloads\crmvisualribbonedit-10810\VisualRibbonEditor\Helpers.cs:line 39 at VisualRibbonEditor.ServiceWrapper.RetrieveMultipleAsync(QueryBase query, Action`1 callback) in D:\Documents and Settings\Office\My Documents\Downloads\crmvisualribbonedit-10810\VisualRibbonEditor\ServiceWrapper.cs:line 43 at VisualRibbonEditor.Helpers.GetRecordsWithCondition(String entityName, String attributeName, ConditionOperator op, Object attributeValue, Action`1 callback, String[] cols) in D:\Documents and Settings\Office\My Documents\Downloads\crmvisualribbonedit-10810\VisualRibbonEditor\Helpers.cs:line 71 at VisualRibbonEditor.Helpers.GetRecordWithCondition(String entityName, String attributeName, ConditionOperator op, Object attributeValue, Action`1 callback, String[] cols) in D:\Documents and Settings\Office\My Documents\Downloads\crmvisualribbonedit-10810\VisualRibbonEditor\Helpers.cs:line 47 at VisualRibbonEditor.Solution.SetupSolution_SolutionRetrieved(Entity solution) in D:\Documents and Settings\Office\My Documents\Downloads\crmvisualribbonedit-10810\VisualRibbonEditor\Solution.cs:line 357 at VisualRibbonEditor.Helpers.c__DisplayClass1.b__0(EntityCollection ec) in D:\Documents and Settings\Office\My Documents\Downloads\crmvisualribbonedit-10810\VisualRibbonEditor\Helpers.cs:line 43 at VisualRibbonEditor.ServiceWrapper.RetrieveMultipleAsync(QueryBase query, Action`1 callback) in D:\Documents and Settings\Office\My Documents\Downloads\crmvisualribbonedit-10810\VisualRibbonEditor\ServiceWrapper.cs:line 43 at VisualRibbonEditor.Helpers.GetRecordsWithCondition(String entityName, String attributeName, ConditionOperator op, Object attributeValue, Action`1 callback, String[] cols) in D:\Documents and Settings\Office\My Documents\Downloads\crmvisualribbonedit-10810\VisualRibbonEditor\Helpers.cs:line 71 at VisualRibbonEditor.Helpers.GetRecordWithCondition(String entityName, String attributeName, ConditionOperator op, Object attributeValue, Action`1 callback, String[] cols) in D:\Documents and Settings\Office\My Documents\Downloads\crmvisualribbonedit-10810\VisualRibbonEditor\Helpers.cs:line 47 at VisualRibbonEditor.Helpers.GetRecordByName(String entityName, String attributeName, Object attributeValue, Action`1 callback, String[] cols) in D:\Documents and Settings\Office\My Documents\Downloads\crmvisualribbonedit-10810\VisualRibbonEditor\Helpers.cs:line 30 at VisualRibbonEditor.Solution.b__13(EntityCollection ec) in D:\Documents and Settings\Office\My Documents\Downloads\crmvisualribbonedit-10810\VisualRibbonEditor\Solution.cs:line 337 at VisualRibbonEditor.ServiceWrapper.RetrieveMultipleAsync(QueryBase query, Action`1 callback) in D:\Documents and Settings\Office\My Documents\Downloads\crmvisualribbonedit-10810\VisualRibbonEditor\ServiceWrapper.cs:line 43 at VisualRibbonEditor.Solution.GetAppRibbon() in D:\Documents and Settings\Office\My Documents\Downloads\crmvisualribbonedit-10810\VisualRibbonEditor\Solution.cs:line 331 at VisualRibbonEditor.Solution.SetupSolution() in D:\Documents and Settings\Office\My Documents\Downloads\crmvisualribbonedit-10810\VisualRibbonEditor\Solution.cs:line 314 at VisualRibbonEditor.Solution.b__0(Object sender, DoWorkEventArgs e) in D:\Documents and Settings\Office\My Documents\Downloads\crmvisualribbonedit-10810\VisualRibbonEditor\Solution.cs:line 45

    Reply
  5. ShaneCraddock

     /  September 13, 2012

    Would you be able to send me the editor built for IFD/ ADFS ?
    I’ve tried everything I can and I can’t get it to build, I get this error :
    Error 1 Unknown build error, ‘Cannot resolve dependency to assembly ‘System.Windows, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e’ because it has not been preloaded. When using the ReflectionOnly APIs, dependent assemblies must be pre-loaded or loaded on demand through the ReflectionOnlyAssemblyResolve event.’ VisualRibbonEditor

    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: