Thursday, 19 September 2019

Sharepoint upload file increase and Links

Error:

The request message is too big. The server does not allow messages larger than 2097152 bytes

Solution:

Run script  in Sharepoint Power Shell :
$ws = [Microsoft.SharePoint.Administration.SPWebService]::ContentService
$ws.ClientRequestServiceSettings.MaxReceivedMessageSize = 20242880
$ws.ClientRequestServiceSettings.MaxParseMessageSize  = 20242880
$ws.Update()

====================
     string documentBody1 = _itemAttachment.Attributes["body"].ToString();
var aaa=new  MemoryStream(Convert.FromBase64String(documentBody1));

   public static void UploadFileToSP(ClientContext ctx, string listName, string fullUrlWithFileName, byte[] content,MemoryStream aaa)
        {
            //  Send the file content to SP
            Microsoft.SharePoint.Client.List list = ctx.Web.Lists.GetByTitle(listName);
            FileCreationInformation file1 = new FileCreationInformation();
            file1.Overwrite = true;
            file1.Url = fullUrlWithFileName;// "/demo/email/57FD46F959DBE81180C200155D668D45_testfilename";// fullUrlWithFileName;
                                            // file1.Content = content;
            file1.ContentStream = aaa;
            Microsoft.SharePoint.Client.File uploadFile = list.RootFolder.Files.Add(file1);
            //list.con
            ctx.Load(uploadFile);
            ctx.ExecuteQuery();
        }
=========================

Sharepoint 'Sync Now' functionality and share files on network drive

https://bitwizards.com/thought-leadership/blog/2015/december-2015/how-to-map-sharepoint-document-libraries-as-networ

https://support.office.com/en-us/article/sync-sharepoint-files-with-the-onedrive-for-business-sync-client-groove-exe-59b1de2b-519e-4d3a-8f45-51647cf291cd


Sharepoint upload solution in SP:
https://sharepoint.stackexchange.com/questions/189704/how-to-upload-a-sharepoint-site-template-wsp-when-the-solution-link-is-missin

https://www.c-sharpcorner.com/UploadFile/93cb27/deploying-the-solution-in-sharepoint-online/

Powershell Script:
Power shell Script

./AllowHtcExtn.ps1 https://mysharepointserver/CRM 




SharePoint Online

FileCreationInformation.Content=Convert.FromBase64String(fileData);
//fileData being the document body of my attachment.

Instead of using the Content method of FileCreationInformation, I used ContentStream as below:

FileCreationInformation.Content=new MemoryStream(Convert.FromBase64String(fileData));



Wednesday, 18 September 2019

MSCRM Disable Fields in Business Process Flow

Add the prefix 'header_process_' of the field schema name 'new_testfield' and use the below script for disabling the field using javascript:

Xrm.Page.getControl('header_process_new_testfield').setDisabled(true);



Thanks
Narendra

Sunday, 15 September 2019

MSCRM 365 v9 bind subgrid using fetch XML by javascript

function QuoteLinesFromQuote(executionContext) { 
    var formContext = executionContext.getFormContext();
    //Show the section on function call.
Xrm.Page.ui.controls.get('Quotelines').setVisible(true);
    // Xrm.Page.ui.tabs.get("tab_Quotes").sections.get("CONTACT_PREFERENCES").setVisible(true);
    // Quotelines : is name of subgrid given on Form. 
    var objSubGrid = window.parent.document.getElementById("Quotelines");
    var globalContext = Xrm.Utility.getGlobalContext();
    var version = globalContext.getVersion();
    // You need the timeout for at least the form is properly loaded.
    var subRowCount = 1;
    if (subRowCount == 0) {
        setTimeout(QuoteLinesFromQuote(executionContext), 5000);
    } else {
        // When subgrid is loaded, get the other relevant value.
        var QuoteIDValue = formContext.data.entity.getId();
        //Create FetchXML for sub grid to filter records
        var FetchXml = '<fetch version = "1.0" output-format="xml-platform" mapping = "logical" distinct = "false" > ' +
            '<entity name="quotedetail">' +
            '<attribute name="productid" />' +
            '<attribute name="productdescription" />' +
            '<attribute name="priceperunit" />' +
            '<attribute name="quantity" />' +
            '<attribute name="extendedamount" />' +
            '<attribute name="quotedetailid" />' +
            '<order attribute="productid" descending="false" />' +
            '<filter type="and">' +
            '<condition attribute="quoteid" operator="eq" uitype="quote" value="{' + QuoteIDValue + '}" />' +
            '</filter>' +
            '</entity>' +
            '</fetch>';

        // Layout of subgrid.
        //var LayoutXml = "<grid name='resultset' object='8' jump='new_name' select='1' preview='1' icon='1'>" +
        //    " <row name='result' id='new_boat'>" +
        //    "<cell name='productid' width='100' />" +
        //    "<cell name='productdescription' width='200' />" +
        //    "<cell name='priceperunit' width='100' />" +
        //    "<cell name='quantity' width='200' />" +
        //    "<cell name='quotedetailid' width='200' />" +
        //    "</row>" +
        //    "</grid>";
        // Apply layout and filtered fetchXML
        //objSubGrid.control.SetParameter("layoutXml", LayoutXml);
        objSubGrid.control.SetParameter("fetchXml", FetchXml);
        //Refresh grid to show filtered records only.
        objSubGrid.control.Refresh();
    }
}

Monday, 19 August 2019

MS CRM Email router Incoming Status : ERR [SYS/TEMP] Temporary system problem. Please try again later.

Error:
Incoming Status: Failure - An error occurred while executing POP3 command "<Command removed for security reasons>". The server response was: "-ERR [SYS/TEMP] Temporary system problem.  Please try again later. l17mb180361752iob".

Solution:
Reset the password of that email ID and update in email router and mailbox profile of CRM then issue will resolve.

Thanks
Narendra Singh

Saturday, 17 August 2019

persits.upload not found

Error:
Microsoft VBScript runtime  error '800a01ad'

ActiveX component can't create object

Set Upload = Server.CreateObject("Persits.Upload")  create object failed

Solution:

Download the aspupload.dll and register the dll by command prompt.

http://www.aspupload.com/download.html


Command Prompt

C:\Program Files (x86)\Persits Software\AspUpload\Bin>regsvr32 aspupload.dll


Thanks

Monday, 15 July 2019

MSCRM data encryption key issue

Error:
Data encryption can't be activated because the encryption key doesn't match the source encryption key used to encrypt the data. If you contact support, please provide the technical details.


Solution

SQL query for solving the same issue:

UPDATE EmailServerProfile SET IncomingPassword=null
UPDATE EmailServerProfile SET OutgoingPassword=null
UPDATE Mailbox SET Password=null
UPDATE Queue SET EmailPassword=null
UPDATE UserSettings SET EmailPassword=null

For more details check this Link.

Friday, 5 July 2019

Microsoft Email router Incoming profile issue

Issue:
Incoming Status: Failure - The remote Microsoft Exchange email server returned the error "(401) Unauthorized". Verify that you have permission to connect to the mailbox. The request failed with HTTP status 401: Anonymous Request Disallowed. 



Solution:
1. Update the password in Mailbox profile.


2. Add the correct email server profile in the mailbox.

3. Click on 'Approve email' and 'Test and enable mailbox' in the mailbox profile.
4. Restart the email Router service.
5. Open the MS Email router configuration and check the status again. The issue will be resolved.


Enjoy :) 

Thursday, 27 June 2019

Access WCF webservice using POSTMAN


Step 1: Create one WCF Service Application and add the below line for OperationContract

 [WebInvoke(Method = "POST",BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)]



Step 2: Add the below script in web.config file.

<system.serviceModel>
    <services>
      <service behaviorConfiguration="Default" name="WcfService1.Service1">
        <endpoint address="web" behaviorConfiguration="webBehavior" binding="webHttpBinding" contract="WcfService1.IService1" />
        <endpoint address="ws" binding="wsHttpBinding" bindingConfiguration="wsBehavior" contract="WcfService1.IService1" />
      </service>
    </services>
    <behaviors>
      <endpointBehaviors>
        <behavior name="webBehavior">
          <webHttp />
          <!--<enableWebScript/>-->
        </behavior>
      </endpointBehaviors>
      <serviceBehaviors>
        <behavior name="Default">
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="true"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <bindings>
      <wsHttpBinding>
        <binding name="wsBehavior">
          <security mode="None" >
            <transport clientCredentialType="None"/>
          </security>
        </binding>
      </wsHttpBinding>
    </bindings>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true"/>
  </system.serviceModel>




Step 3: Run the web service(in visual studio) and Copy the Service URL



Step 4: Add the parameters(ref the below screenshot) in Postman and send the request and you will get the successful response



Cheers, 😃 and enjoy your life.



Tuesday, 25 June 2019

SQL database shrink query

use db
go
sp_helpfile
ALTER DATABASE db SET RECOVERY SIMPLE WITH NO_WAIT
dbcc shrinkfile (db_log, 5)
--dbcc shrinkfile (db_log2, 5)
ALTER DATABASE db SET RECOVERY FULL WITH NO_WAIT

Thursday, 23 May 2019

Extensionlessurlhandler-integrated-4.0 error 500.19

Error:
extensionlessurlhandler-integrated-4.0 error 500.19




Solution: 
Add the below windows features on the server


Friday, 3 May 2019

MSCRM Metadata contains a reference that cannot be resolved


Error:
Metadata contains a reference that cannot be resolved: 'https://crmservice/instance/XRMServices/2011/Organization.svc?wsdl&sdkversion=7.1'.","System.Net.WebException: The request was aborted: Could not create SSL/TLS secure channel.    at System.Net.HttpWebRequest.GetResponse()    at System.ServiceModel.Description.MetadataExchangeClient.MetadataLocationRetriever.DownloadMetadata(TimeoutHelper timeoutHelper)    at System.ServiceModel.Description.MetadataExchangeClient.MetadataRetriever.Retrieve(TimeoutHelper timeoutHelper)"



Solution:

Add below line before executing the CRM Org service:

ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;