terça-feira, Agosto 26, 2014

Free version of SharePoint App Custom Action & Ribbon Manager available in Office Store

After requests from users to publish the app in the Office Store, Processlynx launch a Free Custom Action and Ribbon Manager in the Store. 
This app simulates some actions from talked in previous articles and originally from the following article:


SharePoint App Processlynx Custom Action and Ribbon Manager Launch


This app allows site administrators to customize "SharePoint App Sites" (app webs) using the extended out of box functionalities. For example, you can customize the Ribbon with new actions without the need of involving a developer.
In essence, it makes the link between site administration and development . It reduces implementation time, it increases productivity and reduces operational costs.

Features:
- Reduces complexity of the functionalities "Custom Action", "Ribbons" and "ScriptsLinks" and helps site administrators to customize app webs.
- Uses the look and feel themes from host web to have the same visual experience.
- Provides a recycle bin location “App Web” where the Custom Actions, Ribbons and ScriptsLinks can be restored or deleted.
- Generates error report to trace permission issues or general problems.

This version of the Ribbon Manager is free, and is limited for use with "SharePoint App Sites" (app webs). 


to include the app in your sharepoint site you can select "Options > Add an app" and search for ID WA104374259.




After this option is selected you are able to access the Custom Action and Ribbon Manager app and install your SharePoint enviroment.


The app has a support List/Libraries to support and visualize the changes made by the App.

  • All the changes are located in the app web.




The app allow you to define multiple locations for your custom actions and associated types as a normal declarative XML but with a better UX.



You can use a Code Source editor for your custom actions associated with the correct actions into Ribbon Buttons.



Here the video of the Processlynx Ribbon Manager on how to configure a complex Ribbon.


Hope you enjoy this free app,
Kind regards, 
Andre Lage 

quinta-feira, Julho 31, 2014

Yes, there are flying Unicorns in SharePoint sites

Yes, vacations are coming, sun, family time and relax everything we should be doing after so many months...
For final article before turn off everything and go for vacations, here is a funny article like flying Unicorns in your SharePoint Site, yes you can make some funny things with some CSS, jquery, html and following Jquery Plugin Circulate.
http://css-tricks.com/examples/Circulate/

Here the following output:



Here the video:



How to implement this solution:

Include the following files in SharePoint Asset Library:
  • jquery.min.js
  • jquery.easing.1.2.js
  • jquery.circulate.js
  • style.css
  • Unicorn.jpg image :)
Add a Script Editor Web Part in the SharePoint Page and include the following HTML:
PS: This example was made without MDS Feature activated

<script src="/SiteAssets/jquery-1.11.1.min.js"></script>

<script src="/SiteAssets/jquery.easing.1.2.js"></script>

<script src="/SiteAssets/jquery.circulate.js"></script>

<link rel="stylesheet" type="text/css" href="/SiteAssets/style.css">

<script>

$(window).load(function() {
$("#DeltaPlaceHolderMain").before('<img src="/SiteAssets/unicorn.png" id="unicorn">');
$("#unicorn").css("left", $("#unicorn").position().left).circulate({
            sizeAdjustment: 160,
            speed: 2000,
            width: -920,
            height: 50,
            loop: true,
            zIndexValues: [0, 50, 50, 0]
    });
 });
</script>

The key for the implementation is the Div id="DeltaPlaceHolderMain " where should be implemented,  for this example has to be added before DeltaPlaceHolderMain then should be call the following method "circulate(.....)"

Here a video of the Implementation



Well that is everything for today, 
Have a nice vacations to you all, 

Hope you enjoy this article,
Kind regards, 
André Lage

quarta-feira, Julho 30, 2014

How to create Custom Ribbon Button to Move Documents in Library with Metadata/versions

This article is follow up from my last article "OneNote Custom Actions to support Create/Move Pages and Sections and conversion to Folder in SharePointwith a new feature "Move document in Library" Ribbon Action.

This Feature gives to users the ability to manage documents in a very easy way using a tree Dialog of folders from the Document Library and maintain the Metadata/versions associated.

Here the final output of the solution,


One thing i didn't like in my last article was the ability to manage documents. The "Drag and Drop" feature from SharePoint 2013 is a GREAT feature, but users aren't that skillful about managing documents in folders and they get confused very easily.  
Like i show in my last video you can count a loot of steps to move documents from one folder to another even using the drag and drop option and this is what i am trying to avoid.

There is another Out of Box tool call "Site Content and Structure Feature" that does this and a lot more but i don't want to use a cannon to kill a fly.... 

Site Content and Structure Feature

This great Out of the Box feature from SharePoint already exist for some years and gives users the ability to manage items or Document across the Site Collection, but this option just exist when Web Content Management is activated and with SharePoint Standard license, no to SharePoint Foundation and this is the reason why i created this feature, is more limited (Only move documents in current Document Library folders to preserve the Metadata) but responds my needs without to much clicks. 

Pre-Conditions:
You need to have SharePoint Standard license then you should activate the following feature:

  • Site collection features
    • Activate "SharePoint Server Publishing Infrastructure"
  • Manage site features
    • Activate "SharePoint Server Publishing"

After activated you can access in the foloowing path

Site Settings > Site Administration > Content and structure



To support this option, was used the SharePoint Out of the Box Method "LaunchPickerTreeDialogSelectUrl" already discuss in early articles.

Here are some links that support me in this article:
OneNote Custom Actions to support Create/Move Pages and Sections and conversion to Folder in SharePoint
http://aaclage.blogspot.ch/2014/07/onenote-custom-actions-to-support.html
SharePoint 2013: Manage Site/Web/Lists/Folder Filter using Picker Tree Dialog (LaunchPickerTreeDialogSelectUrl )

http://aaclage.blogspot.ch/2014/02/sharepoint-2013-manage-siteweb-lists.html
SharePoint 2013 App - Manage List Threshold (Moving Multiple Documents in Folders) Office365/ On-premise
http://aaclage.blogspot.ch/2014/02/sharepoint-2013-app-manage-list.html
SharePoint App Processlynx Custom Action and Ribbon Manager Launch
http://aaclage.blogspot.ch/2014/06/sharepoint-app-processlynx-custom.html

How solution "Move document in Library" Works

This solution creates a new Ribbon call "Move document in Library" in all templates of Document Libraries and is enabled when a document is selected.


When the Ribbon "Move document in Library" is enabled you are able to select the option.
This option opens a dialog box of the Library and his folders and sub folder "same behavior when users uploads documents to a specific folder".
This dialog box give the ability to select the folder where the document will be moved.


After select OK in the dialog box the document will be moved to the selected Subfolder as shown in the image without losing Metadata or versions.

How was configured(Implementation)

To configured this funcionalities i used the Processlynx Custom Action & Ribbon Manager for the customizations of the Ribbon and Actions associated and everything was made using Javascript and JSOM.
But you can also use Visual Studio declarative XML, JSOM or REST Custom Actions from SharePoint.

This code was tested in Office 365 Enviroment and Internet Explorer Browser 11.

With Processlynx Custom Action & Ribbon Manager

This SharePoint App Manage the CustomActions in the HostWeb in a very eficient and user friendly way.
For more info about the tool here a link


This options was configured in my last article OneNote Custom Actions to support Create/Move Pages and Sections and conversion to Folder in SharePoint and was given a new option in the Custom Action "OneNote Ribbon Support".


Configure "Move document in Library" Ribbon

LocationRibbon.Documents.Manage

Enable Script Code:

javascript: var EnableDisableItem = function() {
 this.clientContext = SP.ClientContext.get_current();
 this.selectedItems = SP.ListOperation.Selection.getSelectedItems(this.clientContext);
 if (selectedItems.length==1)
 {
if (selectedItems[0].fsObjType == 0)
{return true;}
else 
{return false;}
 }
 if (selectedItems.length!=1)
 {return false;}
 };
 EnableDisableItem();

Action Script Code:

javascript:
function loadScript(url, callback){
    var script = document.createElement("script");
    script.type = "text/javascript";
    if (script.readyState){
        script.onreadystatechange = function(){
            if (script.readyState == "loaded" || script.readyState == "complete"){
                script.onreadystatechange = null;callback();
            }};
    } else {
        script.onload = function(){callback();};
    }
    script.src = url;
    document.getElementsByTagName("head")[0].appendChild(script);
getWebProperties();
}
function LaunchTargetPicker(WebId,ListId,RootFolderList) {
var values = SP.ListOperation.Selection.getSelectedItems();
    var callback = function (dest) {
        if (dest != null && dest != undefined && dest[3] != null) {MoveItems(dest[3],values,ListId,RootFolderList);}
    };
ListId.replace("{", "");
ListId.replace("}", "");
    var iconUrl = "/_layouts/15/images/smt_icon.gif?rev=32";
SP.SOD.executeFunc('pickertreedialog.js', 'LaunchPickerTreeDialogSelectUrl', function () {
        LaunchPickerTreeDialogSelectUrl('CbqPickerSelectListTitle', 'CbqPickerSelectListText', 'websListsFolders', 'SPList:'+ListId+'?SPWeb:'+WebId+':', _spPageContextInfo.siteAbsoluteUrl, '', '', '', iconUrl, '', callback, 'true', '');
    });
}
function getWebProperties() {
        var ctx = new SP.ClientContext.get_current();
        var web = ctx.get_web();
        ctx.load(web,'Id');
        ctx.executeQueryAsync(function(){getListRootUrl(web.get_id(),'{ListId}')},Function.createDelegate(this, this.error));
    }
function getListRootUrl(WebID,ListId){
ListId.replace("{", "");
ListId.replace("}", "");
var ctx = new SP.ClientContext.get_current();
        var targetList = ctx.get_web().get_lists().getById(ListId);
var RootFolderList = targetList.get_rootFolder();
        ctx.load(RootFolderList, 'ServerRelativeUrl'); ctx.executeQueryAsync(function(){LaunchTargetPicker(WebID,ListId,RootFolderList)},Function.createDelegate(this, this.error));
}

function MoveItems(SelectedFolder,SelectedItem,ListId,RootFolderList) {
    Items = SelectedItem;
ListId.replace("{", "");
ListId.replace("}", "");
    var ctx = new SP.ClientContext.get_current();  
var targetList = ctx.get_web().get_lists().getById(ListId);    
    var currentItem = targetList.getItemById(Items[0].id);
    var file = currentItem.get_file();
    ctx.load(file, 'Name');
    ctx.executeQueryAsync(function(){
try {
if (file != null) {
var _destinationlibUrl;
if (SelectedFolder == "/")
{ _destinationlibUrl = RootFolderList.get_serverRelativeUrl()+ SelectedFolder + file.get_name(); }
else {
_destinationlibUrl = RootFolderList.get_serverRelativeUrl()+ SelectedFolder +"/"+ file.get_name();
}
file.moveTo(_destinationlibUrl, SP.MoveOperations.allowBrokenThickets);
ctx.executeQueryAsync(function(){SP.UI.Notify.addNotification('File moved', false);SP.UI.ModalDialog.RefreshPage(SP.UI.DialogResult.OK);}, Function.createDelegate(this, this.error));
}
} catch (e) {
alert(e.message);
}
}, Function.createDelegate(this, this.error));
}
function MoveFileHandler(SelectedFolder,file,RootFolderList) {
 }
 function error(sender,args){
alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
 }
loadScript(_spPageContextInfo.webAbsoluteUrl+"/_layouts/15/pickertreedialog.js", function(){}); 

Here a simple Form of the configuration:


or use the Code Source editor from the Tool



Configure with SharePoint REST/JSOM or Declarative XML

For the Custom Ribbon/Actions you can include the Custom Ribbon Action with the following XML Structure example:

<CommandUIExtension xmlns="http://schemas.microsoft.com/sharepoint/">
<CommandUIDefinitions>
<CommandUIDefinition Location="<Add Location>.Controls._children">
<Button Id="My Custom Button" LabelText="<Add LabelText>" Image32by32="/_layouts/15/1033/images/formatmap32x32.png?rev=33" Image32by32Left="-305" Image32by32Top="-169" ToolTipTitle="<Add TooltipTile>" Command="<Add ID>.Command" TemplateAlias="o1" />
</CommandUIDefinition>
</CommandUIDefinitions>
<CommandUIHandlers>
<CommandUIHandler Command="<Add ID>.Command" CommandAction="<Add action Code here>" EnabledScript="<Add validation Code here>" />
</CommandUIHandlers>
</CommandUIExtension>

For the REST call you can use the following link
For SharePoint JSOM call you can use the following link

Video


Support Links:
OneNote Custom Actions to support Create/Move Pages and Sections and conversion to Folder in SharePoint
http://aaclage.blogspot.ch/2014/07/onenote-custom-actions-to-support.html
SharePoint 2013: Manage Site/Web/Lists/Folder Filter using Picker Tree Dialog (LaunchPickerTreeDialogSelectUrl )

http://aaclage.blogspot.ch/2014/02/sharepoint-2013-manage-siteweb-lists.html
SharePoint 2013 App - Manage List Threshold (Moving Multiple Documents in Folders) Office365/ On-premise
http://aaclage.blogspot.ch/2014/02/sharepoint-2013-app-manage-list.html
SharePoint App Processlynx Custom Action and Ribbon Manager Launch
http://aaclage.blogspot.ch/2014/06/sharepoint-app-processlynx-custom.html

Hope you like this article,
Kind regards,
André Lage

quarta-feira, Julho 23, 2014

OneNote Custom Actions to support Create/Move Pages and Sections and conversion to Folder in SharePoint

This simple article is about OneNote documents and SharePoint integrations and what can be done to created, support and manage OneNote Document in SharePoint enviroment, in this case Document Library types.
This solution create custom Ribbons action and Custom Menu Item to create OneNote Document and manipulate the content of the OneNote and move to other OneNote documents.

This solution has 2 Ribbon Actions "New OneNote Document" to generate new OneNote Documents and "Convert to OneNote/Folder" where is made the manipulation of OneNote document to move their content.

This article has the following topics
  • Description of the Solution (Business case)
  • Implementation of the Solution in SharePoint Enviroment (Developers or IT Administrators).

PS:yep everything (code, video and article) was made in 1 hour, then is a simple article....

Here some links talking about this and some code associated:
http://modery.net/creating-onenote-notebooks-in-sharepoint-via-jsom/ 
http://aaronsaikovski.wordpress.com/2013/12/06/create-a-folder-and-set-the-progid-programmatically-using-the-sharepoint-2013-csom/
http://aaclage.blogspot.ch/2014/04/how-to-use-progid-in-sharepoint-custom.html

Here is the Custom Actions to manage OneNote Documents:



Here a little description of the Custom Actions and what are doing.

New OneNote Document

This Ribbon option give the option to create a New OneNote Document using the Out of the Box Ribbon Area associated with Document Library.



After the name of the document is selected the file is included in the Document Library.





Convert to OneNote/Folder

This option give the option to user to manipulate the content of OneNote Document, since OneNote is a folder with multiple other documents like ".one" documents, this option gives the option to users to grab the content of the OneNote Document and move to other OneNote Documents as shown in the Video bellow.

PS: For this example i rename the OneNote Document to "OneExample"



You can use the custom Menu item option called "Convert to OneNote/Folder", both will do the same task 
PS:the image bellow has different name because was used for other example purpose to show the option in the Menu item. 



After selecte the option the OneNote Document is converted to Folder and are able to see the support documents for the OneNote.

With the Folder option activated, users are able to access to content of OneNote and can move Sections/Pages (.one files) aggregated in the OneNote document to another folder or other OneNote document as shown in the video bellow in the article.
After make the change and move of content you can convert Convert to OneNote Document again using 


After you select the option the convertion of the documet is done and returns to the old format "" 



How was configured(Implementation)

To configured this funcionalities i used the Processlynx Custom Action & Ribbon Manager for the customizations of the Ribbon and Actions associated.
But you can also use Visual Studio declarative XML or REST Custom Actions from SharePoint.

With Processlynx Custom Action & Ribbon Manager

This SharePoint App Manage the CustomActions in the HostWeb in a very eficient and user friendly way.
For more info about the tool here a link



 Include CommandUI.Ribbon for Custom Ribbon Actions

Was created 2 Ribbon Actions called "New OneNote Document" and "Convert to OneNote/Folder".
This Custom Action will create new OneNote Document and Convert the OneNote Document to Folder.




Configure "New OneNote Document"

This option will open a prompt option where you can add the name of the OneNote documet, after this a folder is created and ProgId is changed to "OneNote.Notebook".

Location: Ribbon.Documents.New

Action Script Code:

javascript: function AddOneNoteDocument() { 
var Doc = prompt("Name of OneNote Document", "");
var context=SP.ClientContext.get_current(); 
var web=context.get_web();
var lists=web.get_lists();
var list=lists.getById('{ListId}');

var itemCreationInfo=new SP.ListItemCreationInformation();
itemCreationInfo.set_underlyingObjectType(SP.FileSystemObjectType.folder);
itemCreationInfo.set_leafName(Doc);

var onenoteNotebook=list.addItem(itemCreationInfo);
onenoteNotebook.set_item("HTML_x0020_File_x0020_Type" ,"OneNote.Notebook");
onenoteNotebook.update();

context.load(onenoteNotebook);
context.executeQueryAsync(function(){alert('One Note Created!');SP.UI.ModalDialog.RefreshPage(SP.UI.DialogResult.OK);},function(sender,args){ alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());SP.UI.ModalDialog.RefreshPage(SP.UI.DialogResult.OK);});
};

AddOneNoteDocument();

Here a simple Form of the configuration:

Configure "Convert to OneNote/Folder"

This option will became enable when one folder or OneNote document is selected. When the option is selected Folder became a OneNote document or OneNote document became a Folder.

Location: Ribbon.Documents.Manage

Enable Script Code:

javascript: var EnableDisable = function() {
 this.clientContext = SP.ClientContext.get_current();
 this.selectedItems = SP.ListOperation.Selection.getSelectedItems(this.clientContext);
 if (selectedItems.length==1)
 {
if (selectedItems[0].fsObjType == 1)
{return true;}
else 
{return false;}
 }
 if (selectedItems.length!=1)
 {return false;}
 };

 EnableDisable();

Action Script Code:

javascript: function runCode(GetListid){  
var values = SP.ListOperation.Selection.getSelectedItems();   
var clientContext = new SP.ClientContext.get_current();  
var targetList = clientContext.get_web().get_lists().getById(GetListid);  
var targetListItem = targetList.getItemById(values[0].id);  
clientContext.load(targetListItem, 'HTML_x0020_File_x0020_Type');  
clientContext.executeQueryAsync(function(){
if (targetListItem.get_item('HTML_x0020_File_x0020_Type')=="OneNote.Notebook")
{
if (confirm("Do you want to convert OneNote document to Folder?") == true) {
       ConvertToFormat('{ListId}','');
    } 
}
else{if (confirm("Do you want to convert Folder to OneNote document?") == true) {
    ConvertToFormat('{ListId}','OneNote.Notebook');
} };
},function(sender,args){ alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());});
}
function ConvertToFormat(GetListid,Format){
var clientContext = new SP.ClientContext.get_current();  
var values = SP.ListOperation.Selection.getSelectedItems(); 
var oList = clientContext.get_web().get_lists().getById(GetListid);
    var oListItem = oList.getItemById(values[0].id);
    oListItem.set_item('HTML_x0020_File_x0020_Type', Format);
    oListItem.update();
clientContext.executeQueryAsync(function(){alert('Convertion finish!');SP.UI.ModalDialog.RefreshPage(SP.UI.DialogResult.OK);
},function(sender,args){ alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());});

}runCode('{ListId}');

Here a simple Form of the configuration:



 Include EditControlBlock

This option will include a new Menu item Option where you are able to make the same action as  "Convert to OneNote/Folder".

Include in the URL Action the following Script:

javascript:var GetListID=' {ListId} ';function ConvertToFormat(n,t){var i=new SP.ClientContext.get_current,u=SP.ListOperation.Selection.getSelectedItems(),f=i.get_web().get_lists().getById(n.trim()),r=f.getItemById(u[0].id);r.set_item("HTML_x0020_File_x0020_Type",t);r.update();i.executeQueryAsync(function(){alert("Convertion finish!");SP.UI.ModalDialog.RefreshPage(SP.UI.DialogResult.OK)},function(n,t){alert("Request failed. "+t.get_message()+"\n"+t.get_stackTrace())})}function runCode(n){var r=SP.ListOperation.Selection.getSelectedItems(),t=new SP.ClientContext.get_current,u=t.get_web().get_lists().getById(n.trim()),i=u.getItemById(r[0].id);t.load(i,"HTML_x0020_File_x0020_Type");t.executeQueryAsync(function(){i.get_item("HTML_x0020_File_x0020_Type")=="OneNote.Notebook"?confirm("Do you want to convert OneNote document to Folder?")==!0&&ConvertToFormat(GetListID,""):confirm("Do you want to convert Folder to OneNote document?")==!0&&ConvertToFormat(GetListID,"OneNote.Notebook")},function(n,t){alert("Request failed. "+t.get_message()+"\n"+t.get_stackTrace())})}runCode(GetListID.trim());

Here a simple Form of the configuration:



Configure with SharePoint REST/JSOM or Declarative XML

For the Custom Ribbon/Actions you can include the Custom Ribbon Action with the following XML Structure example:

<CommandUIExtension xmlns="http://schemas.microsoft.com/sharepoint/">
<CommandUIDefinitions>
<CommandUIDefinition Location="<Add Location>.Controls._children">
<Button Id="My Custom Button" LabelText="My Custom Button" Image32by32="/_layouts/15/1033/images/formatmap32x32.png?rev=33" Image32by32Left="-168" Image32by32Top="-68" ToolTipTitle="My Custom Button" Command="My Custom Button.Command" TemplateAlias="o1" />
</CommandUIDefinition>
</CommandUIDefinitions>
<CommandUIHandlers>
<CommandUIHandler Command="My Custom Button.Command" CommandAction="<Add action Code here>" EnabledScript="<Add validation Code here>" />
</CommandUIHandlers>
</CommandUIExtension>

For the REST call you can use the following link
For SharePoint JSOM call you can use the following link


Video of the Configuration

Link references:


Hope you enjoy the simple article, 
Kind regards, 
Andre Lage