locked
My Training RRS feed

  • Question

  • The below Thread is just to note down the issues I faced while working on various companies and resolution I did. This for my records and your knowledge too.

    1. While on MSCRM 2016 Installation, I was unable to delete a SPN as there were multiple SPN values. I used below to solve.

    To Create : SETSPN –a MSCRMAsyncService/SQLXXXLIVE  crmasyncserviceaccount

    To Delete : SETSPN –D MSCRMAsyncService/SQLXXXLIVE  crmasyncserviceaccount

    2. While Configuring MSCRM 2016 Adapter for Connector to Dynamics AX - Configure the port correctly to point WSDL of AX services. 


    Suresh Kumar VC

    Wednesday, November 15, 2017 12:30 PM

Answers

All replies

  • #To clear the site from Maintenance mode after a Site backup through Powershell script.

    $Admin = new-object Microsoft.SharePoint.Administration.SPSiteAdministration('http://portals.abc.com.nz')
    $Admin.ClearMaintenanceMode()

    #Clears all the maintenance modes for all Site Collections in the farm.
    Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
    $webapp = Get-SPSite -Limit ALL
    foreach ($site in $webApp){
    $Admin = new-object Microsoft.SharePoint.Administration.SPSiteAdministration($site.url)
    $Admin.ClearMaintenanceMode()
    }

    Add-PSSnapin Microsoft.SharePoint.PowerShell


    For the deployment of WSP's
    ---------------------------------------------
    Add-SPSolution "C:\Deployments\Release01102016\AC_Budget.wsp"
    Install-SPSolution -Identity AC_Budget.wsp -AllwebApplications –GacDeployment -force
    Update-SPSolution -Identity AC_Webparts.wsp -LiteralPath 'C:\Deploy Files\Deploy Project Workflow\webpart\AC_Webparts.wsp' -GACDeployment


    TO Download WSP through PowerShell
    --------------------------------------------
    $farm = Get-SPFarm
    $file = $farm.Solutions.Item("AC_Webparts.wsp").SolutionFile
    $file.SaveAs("C:\WSP Backup\13-Jul-2015\AC_Webparts.wsp")

    ----------------------------------------------------------
    Backup Farm:
    PS C:\Windows\system32> Add-PSSnapin Microsoft.SharePoint.PowerShell
    Backup-SPFarm -BackupMethod Full -Directory \\servernamelocation\Backup -Verbose
    ----------------------------------------------------------


    add-SPSolution -literalPath "C:\AC Deployments\ABCTimer"

    Run powershell script from command line of powershell:
    ------------------------------------------------------------
    powershell -command "c:\sharepoint\backupschedule\farmfullbackupPowershellscript.ps1"


    Suresh Kumar VC

    Wednesday, December 20, 2017 9:41 AM
  • The Project/Scenario:

    From a hosted Web Application you want to save the data to SharePoint list and run a Nintex workflow to update Vendor details in MS Dynamics Axapta

    Web Application Code:

    protected void Button1_Click(object sender, EventArgs e)

            {

                    lblMessage.Text = ""; Button1.Visible = true;

                    Microsoft.SharePoint.Security.SharePointPermission sp;

                    Microsoft.SharePoint.Client.ClientContext context = new Microsoft.SharePoint.Client.ClientContext("http://SharePointportal.abc.com.kw/abc12/TestSite/");

    //context.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials;

                    context.Credentials = new System.Net.NetworkCredential("sharepointadmin","password","domainname");

                    Microsoft.SharePoint.Client.Web web = context.Web;

    //webcurrentuser

                   strCred = context.Credentials.ToString();  

    //this.lblMessage.Text = strCred + " web-currentuser "  +web.CurrentUser.ToString() ;

                    Microsoft.SharePoint.Client.List list = web.Lists.GetByTitle("AxaptaVendorsList");

    //list.Title = txtVendname.Text.ToString();

    ListItemCreationInformation itemCreateInfo = new ListItemCreationInformation();

                    Microsoft.SharePoint.Client.ListItem oListItem = list.AddItem(itemCreateInfo);

                    oListItem["Title"] = txtVendname.Text.ToString();

                    oListItem["Telephone"] = txtVendtel.Text.ToString();

                    oListItem["AppStatus"] = "Pending";

                    oListItem["Description"] = txtAddrDtls.Text.ToString();

                    oListItem["City"] = txtCity.Text.ToString();

                    oListItem["Block"] = txtBlock.Text.ToString();

                    oListItem["Street"] = txtStreet.Text.ToString();

                    oListItem["Country"] = txtCountry.Text.ToString();

                    oListItem["ContFName"] = txtContFname.Text.ToString();

                    oListItem["ContMName"] = txtContMname.Text.ToString();

                    oListItem["ContLName"] = txtContLname.Text.ToString();

    //UPdate the list

                    oListItem.Update();

                    context.ExecuteQuery();

                string fn = ""; string SaveLocation=""; var fileName="";

        if ((File1.PostedFile != null) && (File1.PostedFile.ContentLength > 0))

                    {

                        fn = System.IO.

                        Path.GetFileName(File1.PostedFile.FileName);

                        SaveLocation = Server.MapPath("App_Data") + "\\" + fn;

                        File1.PostedFile.SaveAs(SaveLocation);

                        fileName = System.IO.Path.GetFileName(SaveLocation);

                    }

            var attInfo = new AttachmentCreationInformation();

                        attInfo.ContentStream = System.IO.File.OpenRead(SaveLocation);  

                        attInfo.FileName = fn;

                        context.Load(oListItem.AttachmentFiles.Add(attInfo));

                       context.ExecuteQuery();

                    lblMessage.Visible = true;  lblMessage.Text = "Dear Vendor, Thanks for submitting the data " + strCred;

                    Button1.Visible = false;

                    GC.Collect();

            }

    Allow this web application to run as SharePoint user credential with Admininistrator privilege from the IIS hosted authentication.--------

    ----------------------------------------------------------------------


    Suresh Kumar VC

    Wednesday, December 20, 2017 1:27 PM
  • In continuation of the above project--

    #WebService / WCF to Axapta http://AXAPTA2012:8101/DynamicsAxapta/Service/Vendor

    publicstring  CreateVendorDetails(Stringvenddtls)

            {

            try{

                   

    //compcode/accountnum/name/currency/vendgroup/paymtermid/party.namealias/party.name/personName.Firsname/

    //DataAreaId|Accountnum|Title|Currency|VendGroup|PaymTermId|Title|Title|ContFName|ContMName|ContLName|

    String[] strArray = venddtls.Split('|');

    chardelimiter = '|'; String[] substrings = venddtls.Split(delimiter);

    VendTableServiceClientproxy = newVendTableServiceClient();

                    AXSPVendWebService.AifVendor.CallContextcontext = newAXSPVendWebService.AifVendor.CallContext();

                    context.Company=strArray[0];

    QueryCriteriacreateQueryCriteria = newQueryCriteria();

    AxdVendTablevendor = newAxdVendTable();

    AxdEntity_VendTable[] vendTables = newAxdEntity_VendTable[1];

    AxdEntity_VendTablevendTable = newAxdEntity_VendTable();

                    vendTable.AccountNum = strArray[1];

                    vendTable.Name = strArray[2];

    //MAKE IT PARAMETER

                    vendTable.Currency = strArray[3];

                    vendTable.VendGroup = strArray[4];

                    vendTable.PaymTermId = strArray[5];

    //Create the party record

    AxdEntity_DirPartyTable_DirPersonparty = newAxdEntity_DirPartyTable_DirPerson();

                    party.NameAlias =strArray[6];

                    party.Name = strArray[7];

    //Vendor Name

    //Set the name fields

    AxdEntity_PersonNamepersonName = newAxdEntity_PersonName(); //vendor contact info

                    personName.FirstName = strArray[8]; personName.MiddleName = strArray[9]; personName.LastName = strArray[10];

    //Add the names to the party record and set the name sequence

                    party.PersonName = newAxdEntity_PersonName[1] { personName};

                    //DIRPARTYPOSTALADDRESSVIEW // DIRPARTYCONTACTINFOVIEW

                    vendTables[0] = vendTable;

                    vendor.VendTable = vendTables;

                    context.LogonAsUser =

    String.Format("domainname\\{0}", "useraccount");

                    proxy.create(context,vendor );

    varuser = System.Security.Principal.WindowsIdentity.GetCurrent().User;

    varuserName = user.Translate(typeof(System.Security.Principal.NTAccount));

    return"1 "+userName  ;

                }

    catch(Exceptionex)

                {

      varuser = System.Security.Principal.WindowsIdentity.GetCurrent().User;

    varuserName = user.Translate(typeof(System.Security.Principal.NTAccount));

    return"0 "+ userName + ex.Message ;

                }

           

            }

     

        }

    ----------------------------------------------------------------------


    Suresh Kumar VC

    Wednesday, December 20, 2017 1:28 PM
  • #In Continuation of the above project

    #In SharePoint

    Create a InfoPath Form default list in SharePoint and data gets saved there. Click on Open a Submit for Approval button which will trigger nintex workflow to push the data to Axapta post business approval 

    Create a Nintex workflow and consume  the above webservice to Axapta for Vendor entity in this scenario and pass the parameters.


    Suresh Kumar VC

    Wednesday, December 20, 2017 1:30 PM
  • Off topic for this forum.

    Thursday, March 15, 2018 1:56 PM
    Moderator