Updates from akhileshgandhi Toggle Comment Threads | Keyboard Shortcuts

  • akhileshgandhi 6:52 pm on August 1, 2018 Permalink | Reply
    Tags: moreyeahs;pnp;sharepoint;modern page   

    Delete webpart from Sharepoint Modern page code using pnp 

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using Microsoft.SharePoint;
    using Microsoft.SharePoint.Client;
    using Microsoft.SharePoint.Client.WebParts;
    using System.Security;
    using OfficeDevPnP.Core;
    using OfficeDevPnP.Core.Pages;

    namespace deleteWebPart
    class Program

    ////define global variables like SharePoint URL, username, web part title, and password
    public static string spURL = “https://cygunssassh.sharepoint.com/sites/lorem”;
    public static string spColl = “https://cygunssassh.sharepoint.com”;
    public static string userName = “tom@CygunsSassh.onmicrosoft.com”, password = “test”;
    public static string webpartName = “Documents”;

    private static void Get_AllSites_and_SubSites_For_Given_Site(string siteUrl)
    var password = new SecureString();
    foreach (char c in “test”.ToCharArray()) password.AppendChar(c);
    var credentials = new SharePointOnlineCredentials(“tom@CygunsSassh.onmicrosoft.com”, password);
    using (ClientContext clientContext = new ClientContext(siteUrl))

    clientContext.Credentials = credentials;
    var web = clientContext.Web;
    List<Web> allSites = new List<Web>();
    clientContext.Load(web, w => w.Webs, w => w.Title, w => w.Url);
    //Getting sub sites and all the nested sub sites
    GetSubSites(clientContext, web.Webs, ref allSites);
    foreach (Web site in allSites)
    Console.WriteLine(site.Title + ” => ” + site.Url);

    ClientSidePage deleteDemoPage = site.LoadClientSidePage(“Home.aspx”);

    OfficeDevPnP.Core.Pages.ClientSideWebPart part = (OfficeDevPnP.Core.Pages.ClientSideWebPart) deleteDemoPage.Controls[0];
    if (part.Title.Equals(“Document library”))
    { part.Delete(); }
    catch (Exception e)
    Console.WriteLine(“error: ” + e.Message.ToString());

    private static void GetSubSites(ClientContext siteCtx, WebCollection webs, ref List<Web> allSites)
    if (webs.Count > 0)
    siteCtx.Load(webs, w => w.Include(a => a.Webs, a => a.Title, a => a.Url));
    foreach (Web web in webs)
    GetSubSites(siteCtx, web.Webs, ref allSites);

    static void Main(string[] args)
    SecureString passWord = new SecureString();
    foreach (char c in password.ToCharArray()) passWord.AppendChar(c);

    using (ClientContext clientContext = new ClientContext(spURL))
    clientContext.Credentials = new SharePointOnlineCredentials(userName, passWord);
    catch (Exception ex)
    Console.WriteLine(“error: ” + ex.Message.ToString());

    //// Get the SharePoint web
    Web web = clientContext.Web;
    clientContext.Load(web, website => website.Webs, website => website.Title);

    //// Execute the query to the server

    //// Loop through all the webs
    foreach (Web subWeb in web.Webs)

    ////How to delete a webpart using client object model
    File file = clientContext.Web.GetFileByServerRelativeUrl(subWeb.ServerRelativeUrl + “/” + subWeb.WelcomePage);
    LimitedWebPartManager wpm = file.GetLimitedWebPartManager(PersonalizationScope.Shared);
    wps => wps.Include(
    wp => wp.WebPart.Title));
    foreach (WebPartDefinition wpd in wpm.WebParts)
    WebPart wp = wpd.WebPart;
    if (wp.Title == webpartName)
    catch (Exception e)
    Console.WriteLine(“error: ” + e.Message.ToString());

  • akhileshgandhi 10:09 am on November 30, 2015 Permalink | Reply  

    Adding new Button in Dynamic CRM Navigation using CRM Nav Workbench 

    Assignment :


    Create a new button on Case Page named as Jira. On Clicking that button load javascript function which shows alert Called Jira Alert

    1. Download RibbonWorkbench2013_2_0_0_7_managed
    2. Upload Solution to your CRM. Import Solution
    3. Go to Solutions



    In Case Form Editor create a webresource Javascript and add function to it.



    Load RibbonWorkbench


    Once RibbonWorkbench has opened select your solution. If you do not have one create a new solution


    10Renaming button to Jira


    Adding new Command to associate it with Button Click Event


    If you have added a new javascript as webresource in your entity then you would need to add it to your Solution to make sure it is available in workbench.


    Also if you do not see your javascript file in workbench that mieans you have not set display name for javascript




  • akhileshgandhi 10:27 am on November 16, 2015 Permalink | Reply  

    Dynamic CRM Service Key Entities 





    KB Article


    Service Appointment

  • akhileshgandhi 10:20 am on November 16, 2015 Permalink | Reply  

    Dynamic CRM Marketing Key Entities 

    • Lead
    • Contact
    • Account
    • List
    • Quick Campaign
    • Campaign
    • Campaign Response
  • akhileshgandhi 9:01 am on November 16, 2015 Permalink | Reply  

    Keys Sales related Entities in Dynamic CRM 

    • Lead
    • Contact
    • Account
    • Opportunity
    • Product
    • Quote
    • Order
    • Invoice
  • akhileshgandhi 6:57 am on July 9, 2015 Permalink | Reply
    Tags: angular, cart, ionic, shoppingcart   

    Build angular ionic shopping Cart 

    I was building a POC for one of my friend and thought will share process of making shopping cart with others. All shopping cart Apps samples provided by others are not really a complete solution which can be used.


    As step 1 I will put screenshots and then in later parts we will try to build code for it

    Few things we will try to achieve in this project


    1. Customer signin

    2. Checking Categories ,Sub Categories and 3 level of filters

    3. Checkout

    4. Cash on delivery or paypal payment . Let we will try google wallet payment integration


    1 2

    4 5 6

  • akhileshgandhi 4:56 pm on June 12, 2015 Permalink | Reply  

    Imp CRM links for O365 devlopment 

    Provider: Microsoft Office 365
    https://disco.crm.dynamics.com/XRMServices/2011/Discovery.svc (North America)
    https://disco.crm4.dynamics.com/XRMServices/2011/Discovery.svc (EMEA)
    https://disco.crm5.dynamics.com/XRMServices/2011/Discovery.svc (APAC)

    Provider: Microsoft Account
    https://dev.crm.dynamics.com/XRMServices/2011/Discovery.svc (North America)
    https://dev.crm4.dynamics.com/XRMServices/2011/Discovery.svc (EMEA)
    https://dev.crm5.dynamics.com/XRMServices/2011/Discovery.svc (APAC)

    The following URLs should be used to access the Organization service(SOAP endpoint):

    https://{Organization Name}.api.crm.dynamics.com/XrmServices/2011/Organization.svc (North America)
    https://{Organization Name}.api.crm4.dynamics.com/XrmServices/2011/Organization.svc (EMEA)
    https://{Organization Name}.api.crm5.dynamics.com/XrmServices/2011/Organization.svc (APAC)

    Where {Organization Name} refers to the Organization that you specify in the URL when accessing the Web application. For example, for Contoso.crm.dynamics.com, the {Organization Name} is Contoso.

    The following URLs should be used to access the Organization Data service(OData REST endpoint)

    https://{Organization Name}.api.crm.dynamics.com/XrmServices/2011/OrganizationData.svc (North America)
    https://{Organization Name}.api.crm4.dynamics.com/XrmServices/2011/OrganizationData.svc (EMEA)
    https://{Organization Name}.api.crm5.dynamics.com/XrmServices/2011/OrganizationData.svc (APAC)

    For On-premisedeployments:
    http://{server}/XRMServices/2011/Discovery.svc for the Discovery service endpoint
    http://{server}/{OrgName}/XRMServices/2011/Organization.svc for the Organization Service endpoint (SOAP)
    http://{server}/{OrgName}/XRMServices/2011/OrganizationData.svc for the Organization Data Service endpoint (REST)
    http://{server}/XRMDeployment/2011/Deployment.svc for the Deployment Service endpoint

    For IFD deployments:
    http://dev.{hostname[:port]}/XRMServices/2011/Discovery.svc for the Discovery service endpoin

  • akhileshgandhi 1:45 pm on May 1, 2015 Permalink | Reply  

    Starting with k2 Smart Objects 

    Essentials K2 test VM

    Important tool to start with

    C:\Program Files (x86)\K2 blackpearl\Bin\SmartObject Service Tester.exe”



  • akhileshgandhi 6:35 pm on April 30, 2015 Permalink | Reply  

    Dynamic CRM trial account 


  • akhileshgandhi 12:18 pm on March 31, 2015 Permalink | Reply
    Tags: calendar, delegate, O365   

    Powershell script to grant delegate permission to O365 Calendar 

    Set-ExecutionPolicy RemoteSigned
    Function Connect-EXOnline {

    $URL = “https://ps.outlook.com/powershell&#8221;

    $Credentials = Get-Credential -Message “Enter your Office 365 admin credentials”

    $EXOSession = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri $URL -Credential $Credentials -Authentication Basic -AllowRedirection -Name “Exchange Online”

    Import-PSSession $EXOSession


    Function Disconnect-EXOnline {

    Remove-PSSession -Name “Exchange Online”

    Set-ExecutionPolicy RemoteSigned

    $allUsers = Get-Mailbox | Select Identity

    Write-Host “Now Start ….”
    Write-Host $allUsers
    ForEach ( $user in $allUsers ) {

    $mailbox = Get-Mailbox -Identity $user.Identity

    $SIPAddress = $mailbox.WindowsEmailAddress
    #If ( $_.Identity -ne $user.Identity ) {
    $var = $SIPAddress +”:\calendar”

    Add-MailboxFolderPermission -Identity $var -User saccount@abc.com -AccessRights PublishingEditor
    Set-MailboxFolderPermission -Identity $var –User saccount@abc.com -AccessRights PublishingEditor


    • bashid 8:46 am on April 21, 2015 Permalink | Reply

      hi Akilesh

      i have created a plan html5 website using bootstrap v3.3.4 and i wanted to convert it in to SharePoint website…as a beginner i need your help to convert bootstrap navbar in to SharePoint top menu bar..

      • akhileshgandhi 6:46 am on July 9, 2015 Permalink | Reply


        I did it 2 years back. I do not have it handy else I would have shared it

Compose new post
Next post/Next comment
Previous post/Previous comment
Show/Hide comments
Go to top
Go to login
Show/Hide help
shift + esc