Plugin error - The size necessary to buffer the XML content exceeded the buffer quota RRS feed

  • Question

  • Tried to create An account with activity (letter) using Related Entities via plugin.

    While debugging i get the following error.

     "The size necessary to buffer the XML content exceeded the buffer quota"


    using System;
    using System.Diagnostics;
    using System.Linq;
    using System.ServiceModel;
    using Microsoft.Xrm.Sdk;
    using Microsoft.Xrm.Sdk.Query;
    using Microsoft.Xrm.Sdk.Messages;
    namespace Related_Entities
        public class MyPlugin : IPlugin
            public void Execute(IServiceProvider serviceProvider)
                IPluginExecutionContext context = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext));
                    IOrganizationServiceFactory serviceFactory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));
                    IOrganizationService service = serviceFactory.CreateOrganizationService(context.UserId);
                    // TODO - Plugin code goes here
                    Entity accounttobecreated = new Entity("account");
                    accounttobecreated["name"] = "Test Account";
                    accounttobecreated["new_sector"] = new OptionSetValue(100000003);
                    accounttobecreated["new_industry2"] = new OptionSetValue(100000015);
                    accounttobecreated["new_region"] = new OptionSetValue(100000000);
                    accounttobecreated["new_customertype"] = new OptionSetValue(100000002);
                    accounttobecreated["new_country"] = new OptionSetValue(100000006);
                    accounttobecreated["new_state"] = new OptionSetValue(100000086);
                    EntityCollection relatedletterstobecreated = new EntityCollection();
                    for (int i = 0; i <= 5; i++)
                        Entity letter = new Entity("letter");
                        letter["subject"] = string.Format("Company Letter{0}", i.ToString());
                    Relationship relationship = new Relationship("new_account_letter");
                    accounttobecreated.RelatedEntities.Add(relationship, relatedletterstobecreated);
                catch (FaultException<OrganizationServiceFault> ex)
                    throw new InvalidPluginExecutionException("An error occurred in the plug-in.", ex);

    I tried this code with reference of the below link.


    Kindly help.

    Thanks in Advance

    Seema Furheen.S

    Thursday, May 14, 2015 10:28 AM