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)

Upload many web resources file

(0) ShareShare
ReportReport
Posted on by 107

Hello,

Is there any way to upload multiple web resources in specific folders into the CRM in one shot ?

Thanks, 

Regarding,

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Guido Preite Profile Picture
    54,086 Moderator on at

    Hi,

    probably the fastest way is to use WebResources Manager from XrmToolBox:

    www.xrmtoolbox.com/.../MsCrmTools.WebResourcesManager

    some instructions: carldesouza.com/web-resources-manager-xrmtoolbox

  • Suggested answer
    gdas Profile Picture
    50,091 Moderator on at

    In addition you can also take a look visual studio developer extension -

    marketplace.visualstudio.com/items

  • Sskod Profile Picture
    107 on at

    Hello,

    Thanks for the reply, unfortunately this doesn't allow giving  a repository, you should do them one by one :(

  • PhuocLV Profile Picture
    347 on at

    pls use my extension [View:https://github.com/phuocle/Dynamics-Crm-DevKit]

  • Sskod Profile Picture
    107 on at

    Hello @Phuoc Le , with pleasure, but I don't find instructions/steps to follow in order to deploy my webresources, is it possible to proivde a guide ?

  • Suggested answer
    Joseph McGregor Macdonald Profile Picture
    597 on at

    Hi Sskod

    If you are using Visual Studio 2017 or 2019 the visual studio extention I have loaded to the marketplace may work well for you. It has a feature to right click one or more selected files in Visual Studio and deploy into web resources in dynamics

    This short article details how the feature works josephmcmac.wordpress.com/.../deploying-dynamics-365-web-resources-in-visual-studio-using-josephm-xrm-vsix

    You can install the extention in the IDE via searching JosephM.Xrm.Vsix in Visual Studio manage extensions or directly download at this link marketplace.visualstudio.com/items

    Code is also all open source

    Hope this helps

  • Suggested answer
    Alan O Keeffe Profile Picture
    100 on at

    This is now possible using Xrm.Device.pickFile.  There is currently a bug where it is not working on the Android/IOS/Windows apps, but it does work on a browser.

     In the following example I am adding multiple files to the notes section of a form on an entity called new_myentity (with a plural name of new_myentitys).

    Create a new button on the form which calls the uploadFiles function (I am not going into the detail of how to add a button to  a form here, just google it).

      

     function uploadFiles() {

            var pickFileOptions = {};

            pickFileOptions.allowMultipleFiles = true;

           

            Xrm.Device.pickFile(pickFileOptions).then(

                function (result) {

                    try {

                        var recordId = Xrm.Page.data.entity._entityId.guid;

                        var i;

                        for (i = 0; i < result.length; i++) {

                            var note = Object();

                            note["subject"] = result[i].fileName;

                            note["filename"] = result[i].fileName;

                            note["mimetype"] = result[i].mimeType;

                            note["objectid_new_myentity@odata.bind"] = "/new_myentitys(" + recordId + ")";

                            note["documentbody"] = result[i].fileContent;

     

                            $.ajax({

                                type: "POST",

                                contentType: "application/json; charset=utf-8",

                                datatype: "json",

                                url: Xrm.Page.context.getClientUrl() + "/api/data/v9.0/annotations",

                                async: false,

                                data: JSON.stringify(note),

                                beforeSend: function (XMLHttpRequest) {

                                    XMLHttpRequest.setRequestHeader("Accept", "application/json");

                                    XMLHttpRequest.setRequestHeader("OData-MaxVersion", "4.0");

                                    XMLHttpRequest.setRequestHeader("OData-Version", "4.0");

                                },

                                success: function (data, textStatus, XmlHttpRequest) {

                                },

                                error: function (XmlHttpRequest, textStatus, errorThrown) {

                                    Xrm.Utility.alertDialog("Error: " + textStatus + " " + errorThrown +

                                        XmlHttpRequest.responseText);

                                }

                            });

                        }

                        alert("" + result.length +" files uploaded");

                    }

                    catch (err) {

                        Xrm.Utility.alertDialog(err);

                    }

     

                },

                function (error) {

                    Xrm.Utility.alertDialog(error);

                });

        }

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