We provide end-to-end SharePoint and Dynamics 365 CRM solutions including installation, development, deployment, and configuration. Our expertise in SharePoint Online, SharePoint On-Premise, SPFx development, SharePoint Designer, PowerShell automation, Microsoft Flow (Power Automate), and Dynamics 365 CRM helps organizations streamline processes, improve customer engagement, and build secure, scalable digital workplace solutions.
4. Add below all code in your js file and refrence that js file on HTML and change the library name and site url in below rest api in javascript function
var callBackTimerArrayList = new Array();
(function ($, window, document, undefined) {
// Create the defaults once
var pluginName = 'dropzone',
defaults = {
width: '100%', //width of the div
height: 42, //height of the div
progressBarWidth: '100%', //width of the progress bars
url: '', //url for the ajax to post
filesName: 'files', //name for the form submit
margin: 0, //margin added if needed
border: '1px dashed #ccc', //border property
background: '',
zIndex: 100, //Z index of element
textColor: '#ccc', //text color
textAlign: 'center', //css style for text-align
text: 'Drop files here to upload', //text inside the div
uploadMode: 'single', //upload all files at once or upload single files, options: all or single
progressContainer: '', //progress selector if null one will be created
src: '', //if preview true we can define the image src
dropzoneWraper: 'nniicc-dropzoneParent', //wrap the dropzone div with custom class
files: [], //Access to the files that are droped
maxFileSize: '5MB', //max file size ['bytes', 'KB', 'MB', 'GB', 'TB']
allowedFileTypes: '*', //allowed files to be uploaded seperated by ',' jpg,png,gif
clickToUpload: true, //click on dropzone to select files old way
showTimer: false, //show time that has elapsed from the start of the upload,
removeComplete: true, //delete complete progress bars when adding new files
preview: false, //if enabled it will load the pictured directly to the html
uploadOnPreview: false, //Upload file even if the preview is enabled
uploadOnDrop: true, //Upload file right after drop
params: {}, //object of additional params
//functions
load: null, //callback when the div is loaded
progress: null, //callback for the files procent
uploadDone: null, //callback for the file upload finished
success: null, //callback for a file uploaded
error: null, //callback for any error
previewDone: null, //callback for the preview is rendered
mouseOver: null, //callback for mouseover event
mouseOut: null, //callback for mouseout event
};
// The actual plugin constructor
function Plugin(element, options) {
this.element = element;
// jQuery has an extend method that merges the
// contents of two or more objects, storing the
// result in the first object. The first object
// is generally empty because we don't want to alter
// the default options for future instances of the plugin
this.options = $.extend({}, defaults, options);
var xhrDone = {};
var timers = {};
var timerStartDate = {};
var uploadIndex = 0;
Plugin.prototype.init = function () {
// Place initialization logic here
// You already have access to the DOM element and
// the options via the instance, e.g. this.element
// and this.options
$(this.element).bind({
dragover: function (e) {
e.preventDefault();
e.stopPropagation();
$(this.element).css({
color: '#000',
'border-color': '#000'
});
}.bind(this),
dragleave: function (e) {
e.preventDefault();
e.stopPropagation();
dragLeave(this);
}.bind(this),
drop: function (e) {
e.preventDefault();
dragLeave(this);
if (!this.options.preview) {
upload(this, e.originalEvent.dataTransfer.files);
} else {
upload(this, e.originalEvent.dataTransfer.files);
}
}.bind(this),
click: function (e) {
if (this.options.clickToUpload) {
var el;
var form;
el = $(this.element).parent().find('input');
if (el.parent().prop('tagName') !== 'FORM') {
form = $("
");
form.bind('change', function () {
$(this).trigger('submit');
}).on('submit', function (event) {
event.preventDefault();
upload(this, event.target[0].files);
var input = $(this.element).parent().find('input');
input.unwrap().hide();
}.bind(this));
el.wrap(form);
}
el.trigger('click');
}
}.bind(this),
mouseover: function (e) {
if (typeof this.options.mouseOver == "function") this.options.mouseOver(this);
}.bind(this),
mouseout: function (e) {
if (typeof this.options.mouseOut == "function") this.options.mouseOut(this);
}.bind(this)
});
if (typeof this.options.load == "function") this.options.load(this);
};
function dragLeave(that) {
var borderColor = that.options.textColor;
var borderCheck = that.options.border.split(" ");
if (borderCheck.length == 3) borderColor = borderCheck[2];
$(that.element).css({
color: that.options.textColor,
'border-color': borderColor
});
}
function upload(that, files)
{
if (that.options.preview) {
if (!checkFileType(that, files[0])) {
if (typeof that.options.error == "function") {
that.options.error($(that.element), "fileNotAllowed", "File is not allowerd to upload! You can only upload the following files (" + that.options.allowedFileTypes + ")");
} else
alert("File is not allowed to upload! You can only upload the following files (" + that.options.allowedFileTypes + ")");
return;
}
if (!checkFileSize(that, files[0])) {
if (typeof that.options.error == "function") {
that.options.error($(that.element), "fileToBig", 'File to big (' + humanFileSize(files[0].size) + ')! Max file size is (' + that.options.maxFileSize + ')');
} else
alert('File to big (' + humanFileSize(files[0].size) + ')! Max file size is (' + that.options.maxFileSize + ')');
return;
}
var reader = new FileReader();
$(that.element).parent().find('img').remove();
$(that.element).css({
'z-index': that.options.zIndex,
position: 'absolute'
}).html('').parent().css('position', 'relative');
var clone = $(that.element).clone();
clone.appendTo($(that.element).parent());
clone.replaceWith('');
$(that.element).parent().find(".previewImg").css({
width: that.options.width,
height: that.options.height,
border: that.options.border,
background: that.options.background,
color: that.options.textColor,
'text-align': that.options.textAlign,
'box-align': 'center',
'box-pack': 'center'
});
reader.onload = function (e) {
$(this.element).parent().find('img').attr('src', e.target.result).show();
//Image not showing on preview fix
$(this.element).parent().find('img').height('0%').height('100%');
if (typeof this.options.previewDone == "function") this.options.previewDone($(this.element));
}.bind(that);
reader.readAsDataURL(files[0]);
}
var key;
if (files) {
that.options.files = files;
if (that.options.removeComplete) {
var $removeEls = $(".progress-bar:not(.active)").parents('.extra-progress-wrapper');
$removeEls.each(function (index, el) {
el.remove();
});
}
var i, formData, xhr;
if (that.options.uploadMode == 'single')
{
//Reset uploading Count
callBackTimerArrayList = [];
// Reset Progress bar
$('#uploadingDocumentsStatus').hide();
$('#divprogressBarControl').css("width", "1%");
$('#divprogressBarControl').text("1%");
///////////////Loop on all documents
for (i = 0; i < files.length; i++)
{
timerStartDate[uploadIndex] = $.now();
formData = new FormData();
xhr = new XMLHttpRequest();
if (!checkFileType(that, files[i]))
{
callBackTimerArrayList.push('1');
addWrongFileField(that, i, uploadIndex);
uploadIndex++;
reamoveErrorProgressBar();
continue;
}
if (!checkFileSize(that, files[i]))
{
callBackTimerArrayList.push('1');
addFileToBigField(that, i, uploadIndex);
uploadIndex++;
reamoveErrorProgressBar()
continue;
}
formData.append(that.options.filesName + '[]', files[i]);
if (Object.keys(that.options.params).length > 0)
{
for (key in that.options.params)
{
formData.append(key, that.options.params[key]);
}
}
if ((!that.options.preview && that.options.uploadOnDrop) || (that.options.preview && that.options.uploadOnPreview))
{
$('#uploadingDocumentsStatus').show();
addProgressBar(that, i, uploadIndex);
bindXHR(that, xhr, i, uploadIndex);
var targetFolderName = readCurrentTargetUrlCookie("UploadedDocumentTargetFolderURl");
$.when(uploadDropedDocuments(targetFolderName, files[i], that.options.url, i, files.length)).done(function (responsecurrentItemId)
{
}
function readCurrentTargetUrlCookie(name)
{
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for (var i = 0; i < ca.length; i++) {
var c = ca[i];
while (c.charAt(0) == ' ') c = c.substring(1, c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
}
return null;
}
function reamoveErrorProgressBar()
{
setTimeout(function () { $('.extra-progress-wrapper').html('');}, 5000);
}
1.Open Site in Sharepoint Designer
2.On Home top Navigation in Ribbon->Site Option->"SaveSiteAsTemplateEnabled" set to true ->Ok->Apply
3.now Click on Save as Template
If Site Template not appearing at the time new site creation
->Go to Top Site Setting
->Click "Page layouts and site templates" under Look and Feel
-> Select "Subsites can only use the following site templates" radio button
->Select your template
->Click Add
-> Click Ok
Warning: Deactivating this solution turns off the capabilities of this solution. Some parts of this site may no longer function. You may want to check the usage of this solution before deactivating it
If in Sandbox Solution Activate/Deactivate button not appearing
->Open Site in Chrome browser
->Go to Solution Gallery
->Select your Solution
->Select Activate/Deactivate Button in Ribbon
->In Popup window
->Right click Insect element/Develop tool/F12
->Select Ribbon warning border
->Bottom of table Select span which has "display:none"
->Uncheck "display:none" to "display:block"
->Now In Ribbon Activate/Deactivate link is appearing
->Choose your action
use below method to clear client side people picker control
clearPeoplePicker("ppowner");
function clearPeoplePicker(pickerId)
{
var toSpanKey = pickerId+"_TopSpan";
var peoplePicker = null;
// Get the people picker object from the page.
var ClientPickerDict = this.SPClientPeoplePicker.SPClientPeoplePickerDict;
// Get the people picker object from the page.
for (var propertyName in ClientPickerDict) {
if (propertyName == toSpanKey) {
peoplePicker = ClientPickerDict[propertyName];
break;
}
}
if (peoplePicker) {
var ResolvedUsersList = $(document.getElementById(peoplePicker.ResolvedListElementId)).find("span[class='sp-peoplepicker-userSpan']");
$(ResolvedUsersList).each(function (index) {
peoplePicker.DeleteProcessedUser(this);
});
}
}