0

I am adding a custom ribbon button which needs to create a folder with specific content type id in a document library.

CommandAction="javascript:{
                        var options = { 
                          url:'http://test-site-2019/test/Forms/Upload.aspx?RootFolder=%2FSCDM%26ContentTypeId=' + 'EACB0B22-9AAC-4291-A0EE-F91C3F66AC96',
                          title:'New Test Folder',
                          dialogReturnValueCallback: function (result, message) {
                            if(result === SP.UI.DialogResult.OK) {
                              SP.UI.ModalDialog.RefreshPage(result);
                            }
                          }
                        };
                        SP.UI.ModalDialog.showModalDialog(options);
                      }"

I am sharing the code above. Problem is that when click the button, the modal dialog is succesfully opening but showing the normal upload.aspx page which requires to upload file and then to fill the properties. The desire result is to show window which gives us the opportunity to type the name of the folder and the custom fields to fill and to be added to the document library. The Id which I am putting in the url is the content type id of the desired content type.

Any suggestions what I am doing wrong?

0

1 Answer 1

0

upload.aspx is for uploading the document. If you need just folder, then folder new button opens in dialog box with no url associated to them. it just plain model dialog box in classic SharePoint sites. If you want to associate metadata with a folder then you have to use the Document Sets. Create a new content type inheriting from Document Set Content type and use same implementation but you need to use NewDocSet.aspx page instead of upload.aspx.

Both, upload.aspx or newdocset.aspx you should pass List=listguid as querystring parameter.

For newdocset.aspx the syntax is {siteurl}/_layouts/15/NewDocSet.aspx?List=listguid&Source=returnurl&ContentTypeId=contenttypeid&RootFolder=serverrelativefolderpath

Let me know if you have any questions.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.