Monday, 2 April 2012

for more crm details and doubts see the links

enable and disable of ribbon button selecting the record:
http://crmdm.blogspot.in/2011/03/how-to-enable-disable-custom-button-on.html
http://madcomputerist.blogspot.in/

more information on crm 2011:
http://blog.webfortis.com/post/2012/02/28/CRM-2011-JavaScript-Tutorial-01-Basic-Field-Calculation.aspx

http://blog.xrm.com/index.php/2011/05/microsoft-dynamics-crm-online-tutorials/

http://www.crmcodex.com/category/mscrm2011/tutorials/

http://blog.customereffective.com/blog/2010/11/top-10-crm-2011-customization-tutorials.html

http://www.powerobjects.com/blog/2012/07/09/guide-for-crm-2011-ribbon-customization/

http://madcomputerist.blogspot.in/

http://weblogs.asp.net/pabloperalta/archive/2011/06.aspx

http://rudravarmabata.blogspot.in/2012/05/mobile-number-validation-using-regex.html

http://www.cartagena.no/SitePages/Articles.aspx?artid=47&CatId=3

http://mscrmkb.blogspot.in/2011_12_01_archive.html

error enabling:

http://msdn.microsoft.com/en-us/library/dwesw3ee.aspx

un able to debug:

http://www.aspdotnet-suresh.com/2011/07/unable-to-start-debugging-on-web-server.html

compare or add date fields:

http://stackoverflow.com/questions/11004752/comparing-adding-and-updating-date-field-in-an-entity

work around custom workflow

http://blogs.inetium.com/blogs/azimmer/archive/2011/03/03/a-workaround-for-custom-workflows-in-crm-online-2011.aspx

http://crmallied.blogspot.in/2012/04/silverlight-create-update-delete.html

for more information on crm 2011

http://www.magnetism.co.nz/blog.aspx/page/2/
http://gtcrm.wordpress.com/2011/03/16/jscript-reference-for-microsoft-crm-2011/

book of crm 2011:
http://blogs.msdn.com/b/microsoft_press/archive/2011/04/26/new-book-working-with-microsoft-dynamics-crm-2011.aspx

more details about crm 2011

http://msdn.microsoft.com/en-us/library/gg509027.aspx

useful information:
http://ankit.inkeysolutions.com/search/label/CRM%202011
connecting silverlight to dynamic crm 2011
http://geekswithblogs.net/Nilesh/archive/2011/08/30/hosting-silverlight-4.0-application-in-dynamics-crm-2011.aspx
interview questions for dynamic crm 2011
http://crmbusiness.wordpress.com/2011/11/25/crm-2011-common-crm-interview-questions-but-what-do-they-tell-you/

Akilan blog:

http://akilanaki.blogspot.in/


refer for xml :
http://forums.silverlight.net/t/24141.aspx/1

refer update a record :
http://social.microsoft.com/Forums/uk/crmlabs/thread/ed17c5e0-0f60-4054-9aa1-45456d058da3

for xml to silverlight:
http://www.dotnetfunda.com/articles/article1734-how-to-read-a-local-xml-file-in-silverlight-and-to-read-a-xml-file-in-silve.aspx

create a record in dynamic crm 2011 from website:
http://blogs.msdn.com/b/crminthefield/archive/2011/05/18/how-to-create-a-simple-webpage-leveraging-the-crm-2011-iorganizationservice-web-service.aspx

http://inogic.blogspot.in/2011/11/crm-2011-developer-toolkit_18.html

http://gtcrm.wordpress.com/2011/01/18/how-to-view-ribbon-definitions-in-crm-2011-3/

http://www.dynamicscrmtrickbag.com/2012/02/

tips: http://info.profad.com/bid/83199/Time-Saving-Tips-for-Microsoft-Dynamics-CRM-2011-1

http://mileyja.blogspot.in/2011/06/create-entity-in-microsoft-dynamics-crm.html

lot of kits and training meterials:

http://stackoverflow.com/questions/9211109/getting-started-with-dynamic-crm-2011-microsoft

link for filter and more information on crm :
http://crmscape.blogspot.in/2011/03/crm-2011-odata-json-and-crm-forms.html

for crm option set filter:
http://www.magnetism.co.nz/blog/zhenyu/12-01-18/Filter_Option_sets_by_another_field_in_Dynamic_CRM_2011.aspx

problems occured and solved in 02-04-2012

1: repeating the process

solved by using If(verifier==null) before the asyn() function.

2: application value becoming null

then used the code with
 _oauth.Token = Application["auth_token"].ToString();
            _oauth.TokenSecret = Application["auth_tokensecret"].ToString();
            _oauth.Verifier = Application["auth_verifier"].ToString();
          
3: some times system showing error the verifier doesnot match.
sol: do the refresh , rebuild it and run.

Getting access token in Linkedin.

this is the code in silverlight:

namespace Ntier.SocailConnect.SearchEngine
{
    public partial class MainPage : UserControl
    {
        public const string AUTHORIZE = "https://api.linkedin.com/uas/oauth/authorize";
        public string oauth_callback = "http://localhost:2421/Ntier.SocailConnect.SearchEngineTestPage.html";//"http://localhost/DataAccess.asmx";
        public static string verifier;
        public string oauth_token;
       // public Service1SoapClient proxy;
        public MainPage()
        {
            //string verifier;
            InitializeComponent();
          Service1SoapClient  proxy = new Service1SoapClient();           
                proxy.CreateAuthorizationCompleted += new EventHandler<CreateAuthorizationCompletedEventArgs>(proxy_createauthorizationcompleted);
               // proxy.CreateAuthorizationAsync();
         
            IDictionary<string, string> QueryString = HtmlPage.Document.QueryString;
            if (QueryString.ContainsKey("oauth_verifier"))
            {
                verifier = QueryString["oauth_verifier"];               
            }
            if (verifier == null)
            {
                proxy.CreateAuthorizationAsync();
            }

            if (verifier != null)
            {
                proxy.getverifiterAsync(verifier);               
            }

            if (verifier != null)
            {
                proxy.GetAccessTokenCompleted += new EventHandler<GetAccessTokenCompletedEventArgs>(proxy_GetAccessTokenCompleted);
                proxy.GetAccessTokenAsync();

            }           
        }     

        private void proxy_createauthorizationcompleted(object sender, CreateAuthorizationCompletedEventArgs e)
        {
            try
            {               
               string  ret = AUTHORIZE + "?oauth_token=" + e.Result.ToString();              
               System.Windows.Browser.HtmlPage.Window.Navigate(new Uri(ret));
               //NavigationService.Equals(ret, oauth_callback);               
              //  HttpContext.Current.Response.Redirect(ret);
               //textBox1.Text = "Oauth_token :  " + e.Result.ToString();  
               oauth_token = e.Result.ToString();             

            }
            catch
            {
                textBox1.Text = e.Result.ToString();
            }
        }
        private void proxy_GetAccessTokenCompleted(object sender, GetAccessTokenCompletedEventArgs e)
        {
            try
            {
                textBox1.Text = e.ToString();
            }

            catch
            {
                textBox1.Text = "nothing to show";
            }
        }  

    }
}



the code in webservice

private oAuthLinkedIn _oauth = new oAuthLinkedIn();
        [WebMethod]
        public string CreateAuthorization()
        {         
            string auth_link = _oauth.AuthorizationLinkGet();           
            //string oauth_callback = "http://localhost/Ntier.SocialConnect.DataAccess/DataAccess.asmx";
            //string auth_token  = _oauth.Token;
            Application["auth_token"] = _oauth.Token;
            //string auth_tokensecret = _oauth.TokenSecret;
            Application["auth_tokensecret"] = _oauth.TokenSecret;
            //string auth_verify = _oauth.AccessTokenGet(auth_token);
           // string auth_verifier = _oauth.Verifier;
            //string response = oAuthWebRequest(Method.POST, REQUEST_TOKEN, String.Empty);
            //Session["oauthlink"] = auth_link;
         // string auth_access=  _oauth.AccessTokenGet(auth_token);
            return Application["auth_token"].ToString();
        }

        [WebMethod]
        public string GetAccessToken()
        {
            _oauth.Token = Application["auth_token"].ToString();
            _oauth.TokenSecret = Application["auth_tokensecret"].ToString();
            _oauth.Verifier = Application["auth_verifier"].ToString();       

            _oauth.AccessTokenGet(Application["auth_token"].ToString());
            //string oauth_access = Application["auth_token"].ToString();
               Application["oauth_access"] = _oauth.Token;
            //string oauth_access_secret = Application["auth_tokensecret"].ToString();
             //Application["oauth_access_secret"] = _oauth.TokenSecret;
           return oauth_access;
        }

put web method in webservice to get the verifier from silverlight to webservice:

[WebMethod]
        public void getverifiter(string o_verifier)
        {
           //Application["auth_verifier"] = Convert.ToString(o_verifier);
            Application["auth_verifier"] = o_verifier;
          
        }

Saturday, 31 March 2012

Garbage Collection

About Garbage Collection
The .NET Framework's garbage collector manages the allocation and release of memory for your application. Each time you create a new object, the common language runtime allocates memory for the object from the managed heap. As long as address space is available in the managed heap, the runtime continues to allocate space for new objects. However, memory is not infinite. Eventually the garbage collector must perform a collection in order to free some memory. The garbage collector's optimizing engine determines the best time to perform a collection, based upon the allocations being made. When the garbage collector performs a collection, it checks for objects in the managed heap that are no longer being used by the application and performs the necessary operations to reclaim their memory.


Fundamentals of Memory


The following list summarizes important CLR memory concepts.
  • Each process has its own, separate virtual address space. All processes on the same computer share the same physical memory, and share the page file if there is one.
  • By default, on 32-bit computers, each process has a 2-GB user-mode virtual address space.
  • As an application developer, you work only with virtual address space and never manipulate physical memory directly. The garbage collector allocates and frees virtual memory for you on the managed heap.
    If you are writing native code, you use Win32 functions to work with the virtual address space. These functions allocate and free virtual memory for you on native heaps.
  • Virtual memory can be in three states:
    • Free. The block of memory has no references to it and is available for allocation.
    • Reserved. The block of memory is available for your use and cannot be used for any other allocation request. However, you cannot store data to this memory block until it is committed.
    • Committed. The block of memory is assigned to physical storage.
  • Virtual address space can get fragmented. This means that there are free blocks, also known as holes, in the address space. When a virtual memory allocation is requested, the virtual memory manager has to find a single free block that is large enough to satisfy that allocation request. Even if you have 2 GB of free space, the allocation that requires 2 GB will be unsuccessful unless all of that space is in a single address block.
  • You can run out of memory if you run out of virtual address space to reserve or physical space to commit.
Your page file is used even if physical memory pressure (that is, demand for physical memory) is low. The first time your physical memory pressure is high, the operating system must make room in physical memory to store data, and it backs up some of the data that is in physical memory to the page file. That data is not paged until it is needed, so it is possible to encounter paging in situations where the physical memory pressure is very low.




Garbage collection occurs when one of the following conditions is true:
  • The system has low physical memory.
  • The memory that is used by allocated objects on the managed heap surpasses an acceptable threshold. This means that a threshold of acceptable memory usage has been exceeded on the managed heap. This threshold is continuously adjusted as the process runs.
  • The GC.Collect method is called. In almost all cases, you do not have to call this method, because the garbage collector runs continuously. This method is primarily used for unique situations and testing.


    GC.Collect Method

    Use this method to try to reclaim all memory that is inaccessible.
    All objects, regardless of how long they have been in memory, are considered for collection; however, objects that are referenced in managed code are not collected. Use this method to force the system to try to reclaim the maximum amount of available memory.


    using System;
    
    namespace GCCollectExample
    {
        class MyGCCollectClass
        {
            private const int maxGarbage = 1000;
    
            static void Main()
            {
                // Put some objects in memory.
                MyGCCollectClass.MakeSomeGarbage();
                Console.WriteLine("Memory used before collection: {0}", GC.GetTotalMemory(false));
    
                // Collect all generations of memory.
                GC.Collect();
                Console.WriteLine("Memory used after full collection: {0}", GC.GetTotalMemory(true));
            }
    
            static void MakeSomeGarbage()
            {
                Version vt;
    
                for(int i = 0; i < maxGarbage; i++)
                {
                    // Create objects and release them to fill up memory
                    // with unused objects.
                    vt = new Version();
                }
            }
        }
    }
    
    


Thursday, 29 March 2012

adding webservice with authorization in linkedIn. In silverlight (getting verifier)

Step 1:
we need to create a web service with the fuction:

In OauthlinkedIn.cs

public string AuthorizationLinkGet()
        {
//here you need to change your callback url.
            string oauth_callback="http://localhost/DataAccess.asmx";
            string ret = null;          
            string response = oAuthWebRequest(Method.POST, REQUEST_TOKEN, String.Empty,oauth_callback);
            if (response.Length > 0)            {
                //response contains token and token secret.  We only need the token.
                //oauth_token=36d1871d-5315-499f-a256-7231fdb6a1e0&oauth_token_secret=34a6cb8e-4279-4a0b-b840-085234678ab4&oauth_callback_confirmed=true
                NameValueCollection qs = HttpUtility.ParseQueryString(response);               
                if (qs["oauth_token"] != null)
                {
                    this.Token = qs["oauth_token"];
                    this.TokenSecret = qs["oauth_token_secret"];
                 
                    ret = AUTHORIZE + "?oauth_token=" + this.Token;                 

                }
            }


In default.asmx.cs (In webservice)



public string CreateAuthorization()
        {        
            string auth_link = _oauth.AuthorizationLinkGet();                     
            string auth_token = _oauth.Token;
            string auth_tokensecret = _oauth.TokenSecret;
            //string auth_verify = _oauth.AccessTokenGet(auth_token);
            string auth_verifier = _oauth.Verifier;             
            return auth_token;
        }
we can call this function in silverlight.


public partial class MainPage : UserControl
    {
        public const string AUTHORIZE = "https://api.linkedin.com/uas/oauth/authorize";
        public string oauth_callback ="http://localhost/DataAccess.asmx";
        public MainPage()
        {
            InitializeComponent();
            Service1SoapClient proxy = new Service1SoapClient();
            proxy.CreateAuthorizationCompleted+=new EventHandler<CreateAuthorizationCompletedEventArgs>(proxy_createauthorizationcompleted);
           proxy.CreateAuthorizationAsync();
        }

        private void proxy_createauthorizationcompleted(object sender, CreateAuthorizationCompletedEventArgs e)
        {
            try
            {               
               string  ret = AUTHORIZE + "?oauth_token=" + e.Result.ToString();
               System.Windows.Browser.HtmlPage.Window.Navigate(new Uri(ret));
               //NavigationService.Equals(ret, oauth_callback);               
              //  HttpContext.Current.Response.Redirect(ret);
                textBox1.Text = "Oauth_token :  " + e.Result.ToString();
            }
            catch
            {
                textBox1.Text = e.Result.ToString();
            }
        }
    }

result:
you  will redirect to linked in page, if you click on the continue, it will call back to localhost.

if you check in fiddler. you will get the verifier also. 
 




Wednesday, 28 March 2012

how to get the oauth_verifier by sending oauth_token

    public string AuthorizationLinkGet()
        {
            string oauth_callback="http://localhost/DataAccess.asmx";
            string ret = null;
            //string rett = null;
            string response = oAuthWebRequest(Method.POST, REQUEST_TOKEN, String.Empty,oauth_callback);
            if (response.Length > 0)
            {
                //response contains token and token secret.  We only need the token.
                //oauth_token=36d1871d-5315-499f-a256-7231fdb6a1e0&oauth_token_secret=34a6cb8e-4279-4a0b-b840-085234678ab4&oauth_callback_confirmed=true
                NameValueCollection qs = HttpUtility.ParseQueryString(response);
               
                if (qs["oauth_token"] != null)
                {
                    this.Token = qs["oauth_token"];
                    this.TokenSecret = qs["oauth_token_secret"];
                    //this.Verifier = qs["oauth_verifier"];
                    ret = AUTHORIZE + "?oauth_token=" + this.Token;
                   HttpContext.Current.Response.Redirect(ret);
                   

                }
            }
       

           
            return ret;
        }

Wednesday, 21 March 2012

crossdomain.xml and clientaccesspolicy.xml

clientaccesspolicy.xml

<?xml version="1.0" encoding="utf-8" ?>
<!--<?xml version="1.0" encoding="utf-8" ? >-->
<access-policy>
  <cross-domain-access>
    <policy>
      <!--<allow-from >-->
      <allow-from http-request-headers="SOAPAction">

        <domain uri="https://*"/>
        <domain uri="http://*"/>

        <!--<domain url="*"></domain>-->
      </allow-from>
      <grant-to>
        <resource include-subpaths="true" path="/"></resource>
      </grant-to>
    </policy>
  </cross-domain-access>

</access-policy>


crossdomain.xml

<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE cross-domain-policy SYSTEM
"http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
  <allow-http-request-headers-from domain="*" headers="*"/><!--//"SOAPAction,Content-Type"/>-->
</cross-domain-policy>