web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Add custom "sharepoint documents" button to command bar

(0) ShareShare
ReportReport
Posted on by 590

I need to add a "sharepoint documents" button to the command bar in the ribbon to allow users to access Sharepoint document library without going to the chevron and clicking documents. I have read this can be accomplished with the ribbon workbench and some javascript. I have not used ribbon workbench much, does anyone have a good solution or code to share?

 

Thanks

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Aiden Kaskela Profile Picture
    19,696 on at

    Hi Hardik,

    The ribbon workbench is awesome, I recommend it any chance I get. I wrote up a pretty simple step-by-step on how to add a button and have it invoke a javascript resource in CRM 2015 at blog.cobalt.net/.../ribbon-workbench-solution . You'd do the same thing but modify the js to open Sharepoint.

    If this helps I'd love if you would mark this as a Verified answer.

    Thanks,

     Aiden

    EDIT: If all you need to do is open a URL you can do that in the Ribbon Workbench without any javascript by selecting "Open Url Action" instead of javascript function.

  • Suggested answer
    ScottDurow Profile Picture
    21 on at

    You can invoke the navigate function of the sharepoint document navigation link in Javascript - so something like:

    Xrm.Page.ui.navigation.items.get("navDocument").setFocus()

    Hope this helps

  • britman Profile Picture
    590 on at

    If I use the "open url action" that would take probably take me directly into SharePoint. I would like to replicate the Iframe view the current SP integration has. Thanks

  • britman Profile Picture
    590 on at

    Do you have a sample jscript?

    Thanks

  • Verified answer
    ScottDurow Profile Picture
    21 on at

    So you would have a function like:

    function openSharepointDocuments()

    {

       Xrm.Page.ui.navigation.items.get("navDocument").setFocus();

    }

    Then you would add this to a webresource and call using a Custom JavaScript Action in a command button. Aiden's article is a good reference for this.

  • britman Profile Picture
    590 on at

    Thanks both for the input. I have added the button and published the ribbon workbench, but the button is not displayed when I open a case.

  • ScottDurow Profile Picture
    21 on at

    Could you post your Ribbon Xml for us to look at?

  • britman Profile Picture
    590 on at

    Thanks.   <Entity>

         <Name LocalizedName="Service" OriginalName="Service">Service</Name>

         <ObjectTypeCode>4001</ObjectTypeCode>

         <RibbonDiffXml>

           <CustomActions />

           <Templates>

             <RibbonTemplates Id="Mscrm.Templates"></RibbonTemplates>

           </Templates>

           <CommandDefinitions />

           <RuleDefinitions>

             <TabDisplayRules />

             <DisplayRules />

             <EnableRules />

           </RuleDefinitions>

           <LocLabels />

         </RibbonDiffXml>

       </Entity>

       <Entity>

         <Name LocalizedName="Sharepoint Document" OriginalName="">SharePointDocument</Name>

         <ObjectTypeCode>9507</ObjectTypeCode>

         <RibbonDiffXml>

           <CustomActions />

           <Templates>

             <RibbonTemplates Id="Mscrm.Templates"></RibbonTemplates>

           </Templates>

           <CommandDefinitions />

           <RuleDefinitions>

             <TabDisplayRules />

             <DisplayRules />

             <EnableRules />

           </RuleDefinitions>

           <LocLabels />

         </RibbonDiffXml>

       </Entity>

       <Entity>

         <Name LocalizedName="Document Location" OriginalName="">SharePointDocumentLocation</Name>

         <ObjectTypeCode>9508</ObjectTypeCode>

         <RibbonDiffXml>

           <CustomActions />

           <Templates>

             <RibbonTemplates Id="Mscrm.Templates"></RibbonTemplates>

           </Templates>

           <CommandDefinitions />

           <RuleDefinitions>

             <TabDisplayRules />

             <DisplayRules />

             <EnableRules />

           </RuleDefinitions>

           <LocLabels />

         </RibbonDiffXml>

       </Entity>

       <Entity>

         <Name LocalizedName="SharePoint Site" OriginalName="">SharePointSite</Name>

         <ObjectTypeCode>9502</ObjectTypeCode>

         <RibbonDiffXml>

           <CustomActions />

           <Templates>

             <RibbonTemplates Id="Mscrm.Templates"></RibbonTemplates>

           </Templates>

           <CommandDefinitions />

           <RuleDefinitions>

             <TabDisplayRules />

             <DisplayRules />

             <EnableRules />

           </RuleDefinitions>

           <LocLabels />

         </RibbonDiffXml>

       </Entity>

       <Entity>

         <Name LocalizedName="Currency" OriginalName="">TransactionCurrency</Name>

         <ObjectTypeCode>9105</ObjectTypeCode>

         <RibbonDiffXml>

           <RibbonNotSupported />

         </RibbonDiffXml>

       </Entity>

  • britman Profile Picture
    590 on at

    Below is the xml from ribbon workbench

    <RibbonDiffXml>

     <CustomActions>

       <CustomAction Id="po.service.Button1.Button.CustomAction" Location="Mscrm.Form.service.MainTab.Collaborate.Controls._children" Sequence="15">

         <CommandUIDefinition>

           <Button Alt="$LocLabels:po.service.Button1.Button.Alt" Command="po.service.Command0.OpenSharepoint" Id="po.service.Button1.Button" LabelText="$LocLabels:po.service.Button1.Button.LabelText" Sequence="15" TemplateAlias="o1" ToolTipTitle="$LocLabels:po.service.Button1.Button.ToolTipTitle" />

         </CommandUIDefinition>

       </CustomAction>

     </CustomActions>

     <Templates>

       <RibbonTemplates Id="Mscrm.Templates"></RibbonTemplates>

     </Templates>

     <CommandDefinitions>

       <CommandDefinition Id="po.service.Command0.OpenSharepoint">

         <EnableRules />

         <DisplayRules />

         <Actions>

           <JavaScriptFunction FunctionName="openSharepointDocuments" Library="$webresource:po_CommandBarButtonOpenSP" />

         </Actions>

       </CommandDefinition>

     </CommandDefinitions>

     <RuleDefinitions>

       <TabDisplayRules />

       <DisplayRules />

       <EnableRules />

     </RuleDefinitions>

     <LocLabels>

       <LocLabel Id="po.service.Button1.Button.Alt">

         <Titles>

           <Title description="DOCUMENTS" languagecode="1033" />

         </Titles>

       </LocLabel>

       <LocLabel Id="po.service.Button1.Button.LabelText">

         <Titles>

           <Title description="DOCUMENTS" languagecode="1033" />

         </Titles>

       </LocLabel>

       <LocLabel Id="po.service.Button1.Button.ToolTipTitle">

         <Titles>

           <Title description="DOCUMENTS" languagecode="1033" />

         </Titles>

       </LocLabel>

     </LocLabels>

    </RibbonDiffXml>

  • ScottDurow Profile Picture
    21 on at

    All looks good - try publishing again since sometimes the first time doesn't clear the cache.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans