Thursday, March 14, 2013

Pass end point configuration in plugin

when consuming the wcf service in side the plugin, pass the configuration inside the code when initializing the service

for example:

 samplewcfserviceclinet clinet = new samplewcfserviceclinet (GetBasicHttpBinding(),new endpointaddress("endpoint address"))  
 private static BasicHttpBinding GetBasicHttpBinding()  
     {  
       BasicHttpBinding myBinding = new BasicHttpBinding();  
       myBinding.Name = "Binding configuration Name";  
       myBinding.Security.Mode = BasicHttpSecurityMode.None;  
       myBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Windows;  
       myBinding.Security.Transport.ProxyCredentialType = HttpProxyCredentialType.Windows;  
       myBinding.Security.Message.ClientCredentialType = BasicHttpMessageCredentialType.UserName;  
       myBinding.SendTimeout = TimeSpan.FromMinutes(10);  
       myBinding.OpenTimeout = TimeSpan.FromMinutes(10);  
       myBinding.CloseTimeout = TimeSpan.FromMinutes(10);  
       myBinding.ReceiveTimeout = TimeSpan.FromMinutes(10);  
       XmlDictionaryReaderQuotas readerQuotas = new XmlDictionaryReaderQuotas();  
       readerQuotas.MaxArrayLength = int.MaxValue;  
       readerQuotas.MaxDepth = int.MaxValue;  
       readerQuotas.MaxStringContentLength = int.MaxValue;  
       readerQuotas.MaxBytesPerRead = int.MaxValue;  
       readerQuotas.MaxNameTableCharCount = int.MaxValue;  
       myBinding.ReaderQuotas = readerQuotas;  
       myBinding.MaxReceivedMessageSize = 2147483647;  
       myBinding.MaxBufferSize = 2147483647;  
       myBinding.MaxBufferPoolSize = 2147483647;  
       return myBinding;  
     }  
       

Tuesday, November 27, 2012

Disabling all Fields on a Form in CRM 2011(Locking Form for Editing)

Disabling all Fields on a Form in CRM 2011 - Andrew Zimmer - Avtex Blogs for SharePoint, Microsoft CRM, .NET Development, and Infrastructure Services:


"function doesControlHaveAttribute(control) {
    var controlType = control.getControlType();
    return controlType != "iframe" && controlType != "webresource" && controlType != "subgrid";
}

function disableFormFields(onOff) {

    Xrm.Page.ui.controls.forEach(function (control, index) {
        if (doesControlHaveAttribute(control)) {
            control.setDisabled(onOff);
        }
    });
}"

Usage
disableFormFields(true);