Wednesday, November 15, 2017

Attach-File-Modal-Dialog-Sharepoint-2013

HTML Uploader :

<div id="FileUploaded"></div><a href="javascript:openpageindialog();">Attach Supporting Documents</a>

Script :

It opens the Attach File.aspx page in modal pop up.

function openpageindialog() {
    console.log(itemId);
    var options = {
                url: _spPageContextInfo.webAbsoluteUrl + '/_layouts/15/AttachFile.aspx?ListId={GUID}&ItemId='+itemId,
                title: 'Add Attachment',
                width:700,
                height: 200,
                dialogReturnValueCallback: function(result, fileAdded){
console.log(result);
                if(result == SP.UI.DialogResult.OK){
                    alert("file added");
                }
            }            
            }; 
            SP.UI.ModalDialog.showModalDialog(options);
        }

Wednesday, October 25, 2017

Custom designer workflow triggers twice

If you check the workflow history, you will probably see that every time an item is added or modified, the workflow runs twice. That’s why you’re receiving two email notifications. But why is the workflow running twice for each item?
The reason for this is timing. If your workflow is very short and the SharePoint server is very slow, the first instance of the workflow may finish well before the item is fully saved and committed to SharePoint. As the item is being processed, the workflow event receiver can fire again, and start another instance of the workflow.
The solution for this problem is to add a step at the end of your workflow which will pause the workflow for a few minutes – I usually set it to 5 minutes and that seems to solve the problem.


Tuesday, October 24, 2017

Add SharePoint default file attachment to New/Edit/Disp form?

For New form:-
a)Find out the idAttachmentsRow tr.

IDATTACHMENT ROW









b)Place below highlighted code above that TR.

Code For NewForm
 
 
 
For Edit Form:-

a)Find out the idAttachmentsRow tr.
IdAttachmentRow






b)Place below highlighted code above that TR. 
Code For Edit Form
 
 
 
 

For Display Form:-
Navigation to View Item
 
 






In Default Display Page Attachment is shown but when we create any customize display form for list we are not able to see the attachment even though attachment  is  present. 
Default and Customize Display Form
 
 
 
 
 
 

Tuesday, October 3, 2017

SharePoint YES/NO column align in a single row using JSOM Javascript in list form

SharePoint choice column in list form align in a single row :-

Before



After


Assign id to the <td> tag of ms-formbody of the control and add below code in JS file and call alignChoiceColumns() inside document.ready(), it additionally delete the next empty tr .



 function alignChoiceColumns(idOfTDTag) {
            var firstRadio = $("#" + fieldName + " table tbody tr td .ms-RadioText:eq(0)");
            $("#" + fieldName + " table tbody tr td .ms-RadioText:gt(0)").appendTo($(firstRadio));
            $("#" + fieldName + " table tbody tr:gt(0)").remove();
        }

Monday, September 25, 2017

Tabbed Navigation in Sharepoint Custom List forms using JQuery

Below are the steps:

1.       Download Jquery from Jquery.com
2.       Add this to Sharepoint All files Folder or Site Assets.
3.     Create new Custom Form (Newform.aspx)
5.       Add the Following Tab code in your Custom form
<div id="tabs">
    <ul>
        <li><a href="#tabs-1">Tab1</a></li>
        <li><a href="#tabs-2">Tab2</a></li>
       
              </ul>
    <div id="tabs-1">
                   <table border="0" cellspacing="0" width="100%">

                   </table>
              </div>
    <div id="tabs-2">
                   <table border="0" cellspacing="0" width="100%">

                   </table>
              </div>
  
</div>

6.       Cut the Column <Tr> from you list and paste under tabs table.

7.       Save this form and preview in browser
8.       Edit this page after clicking page tab
9.       And add two HTML form web parts on that page
10.       Edit first html web part properties and click source editor button, it will open a window copy and paste the jquery and CSS reference in this window.

In my case I have added this jquery folder to Site Assets.

<link type="text/css" href="SiteUrl/SiteAssets/jquery-ui-1.8.18.custom/css/redmond/jquery-ui-1.8.18.custom.css" rel="stylesheet" />    
<script type="text/javascript" src=" SiteUrl /SiteAssets/jquery-ui-1.8.18.custom/js/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src=" SiteUrl /SiteAssets/jquery-ui-1.8.18.custom/js/jquery-ui-1.8.18.custom.min.js"></script>
<script type="text/javascript">
            $(function(){
                // Tabs
                $('#tabs').tabs();   
            });
</script>
11.       Save the page and Stop editing your Tabs are ready.


Tuesday, August 1, 2017

Export SharePoint Group Users Into Excel 2013 Using OData And REST API

Prerequisites:
  1. SharePoint 2013 On-prem or O365 site, where you have sufficient permissions to perform REST query.
  2. MS Excel 2013, where you already signed-in with your domain account (for On-prem) or O365 account.


Steps to export data from SharePoint to Excel
  1. Open Excel 2013.
  2. Go to ribbon, select DATA and select From Other Sources, and click on From OData Data Feed.
  3. In ‘Data Connection Wizard’ form, provide appropriate REST link (see table above) and click on Next.

    REST Link format to get SPGroup users:

    https://<Your SP2013 Site>/_api/Web/SiteGroups/getbyname('<Group Name')/Users
  4. In Next form, select ‘Users’ table and click Next.
  5. In next form provide an appropriate data connection file name & friendly name (Note: this is not excel file name), check ‘Always attempt to use this file to refresh data’ and click Finish.
  6. In last form, ensure that ‘Table’ is selected. Select worksheet (by default its existing worksheet which is open) and click OK.
  7. Users of that group will be exported to the excel sheet.
Note: We can use same steps to get data from SharePoint lists into Excel with OData Data feed and REST API by providing a valid REST query in step #3.

Monday, July 3, 2017

How to get Item type/entity using REST JQUERY


Clearing Person/Group Values

To clear out or empty the values in person or group columns, how you do it depends on if the column is single-value or multi-value. For ...