Friday, July 26, 2019

How to use Microsoft flow to provide Adobe Sign process as http services

We have a external process running on AWS need to integrate with SharePoint document using Adobe Sign. The document will be pushed to SharePoint through Graph API and like to call service to initialize the Adobe Sign process.  There are may different ways to provide this as service but the quickest way might be the Microsoft Flow.

The way I implemented is to start with OoB "Get signatures on a selected file in SharePoint" flow template. Test this manually and then build our own process. The key two actions we need to use are:

  • Adobe "Upload a document and get a document ID"
  • Adobe "Create an agreement from an uploaded document and send for signature"

In order to be easily called, I've created the activity "When a HTTP request is received" as the trigger for the flow. The overall flow is very simple and actions are listed below.


To demonstrate you could receive the parameter, The relativePath Document/{documentName} has been added. The http call will pass the document name as parameter so flow could find the document. This is described as the below screenshot. 



The url to call the flow is like this below. Please note I have updated the real GUID and the way pass the Document as parameter in red.

https://prod-41.westus.logic.azure.com/workflows/9452e067c6b648c3ac4ed60ab1234567/triggers/manual/paths/invoke/Document/myDocument.docx?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=L5LqW-NVBFc6sdxHpthXXXXXXXXXX

The next key is to get the file content and I found the easy way is to use "Get file content using path" action. You could use other actions but may need to get file Id. The rest actions are same as the OoO flow as we mentioned "Get signatures on a selected file in SharePoint" with few parameters modified for file content.


Now, you have a working http service that can be invoked to integrate SharePoint denouement with Adobe Sign. 

Few enhancements in the future.

  1. Pass file ID like DocID only and the flow to retrieve file name, path, and content form the file ID.
  2. Retrieve "Recipient Email" from SharePoint list item.
  3. Retrieve the Signed document and stored to SharePoint some where or update the document item with the Signed Adobe document Url.
This is my first SharePoint Adobe flow, there will be more integration and enhancements we could implement in the future. 




Wednesday, July 17, 2019

Ultimate procedures to configure "Calendar E-mail Extension for Office 365" apps for SharePoint online


Calendar E-mail Extension for Office 365 sends invitations, handles responses and allows Exchange resources to be booked from a SharePoint calendar, making organizing your calendar as simple and efficient as possible. Here is the summary of the features.

  • Send meeting requests from SharePoint calendars. Now it's possible to invite attendees directly from a SharePoint Online calendar.
  • Book Exchange rooms and equipment. You can book rooms and equipment in Exchange directly from a SharePoint Online calendar.
  • View status replies and attendance status. The SharePoint Online Calendar displays every attendee’s invite status, including their acceptance status, tentative acceptances or any new time suggested.
  • Check availability of attendees and resources. You can check resources' and attendees' availability when scheduling an event directly from a SharePoint Online calendar.

One of the key feature we are looking for is to check the availability of the Exchange rooms and equipment. There are few tricks to make this work in SharePoint online. Here are the details to configured this correctly.


1. The first step is to add "Calendar E-mail Extension for Office 365" to SharePoint online site collection.

You could "Add an app" from the SharePoint online site collection. Here is the app you should add.


2. The second step is to enable the conflict checking scripting on the site collection. This has to be done before you configure the calendar! Otherwise you have to update each existing calendar and save it to pick up the conflict checking script! 

The two steps are:
a. Enable the custom scripts on the site. The SharePoint Online Management  Powershell script is like this below.

# Change this URL to match your admin site
Connect-SPOService -Url https://<yourdomain>-admin.sharepoint.com
# Enter username and password
# Change this URL to match your SharePoint site
Set-SPOSite -Identity https://<yourdomain>.sharepoint.com/sites/yoursite -DenyAddAndCustomizePages $false

b. Update Calendar E-mail Extension for Office 365 app permission. 

  • Open the SharePoint online site where the add-in is installed and navigate to http://<SharePointWebsite>/_layouts/15/AppInv.aspx.
  • Enter the following App Id (d4f43231-f66d-4f82-93b1-bd5a9d9945c1) and click on Lookup.
  • In the Permission Request XML box, enter the following xml:

      <AppPermissionRequests AllowAppOnlyPolicy="true" >
        <AppPermissionRequest Scope="http://sharepoint/content/sitecollection/web"       
         Right="FullControl" />
      </AppPermissionRequests>

  • Click on Trust it.
  • Click on the Calendar E-Mail Extension for Office 365 add-in in the site contents page
  • Click on Configure on each calendar list where the add-in is configured and save the settings again.

The details is listed in vendor's documentation here.

3. The third step is to add calendar and configure the resources.
Click Settings->Site contents->"Calendar E-mail Extension for Office 365", this will bring to configuration page like below.

After add a new calendar, click "Configuration" of the calendar. Enter the account or the shared mailbox account. The enter password to verify.


The you could configure the "Attendees" and "Resources". Please note you might need to add additional room and equipment mailbox for your application as in the below screenshot. Please select "Check Availability".


Then you would need to click save.

4. The forth step is to hide some fields users may not need to simplify the forms.

You could change the room to one of the following three options. This depends on your business requirement
  • Drop-Down Menu
  • Radio Buttons
  • Checkboxes (allow multiple selection)

The procedure is to click "List Settings"->Click "Event (with email extension) Content Types->"Exchange Rooms and Equipment"-> Click "Edit column". Then select one of the three options.



If you need to hide some files from users, please refer to my previous blog for details.



5. The fifth step you might need to do is to disable users to save booking when there is a conflict.

The default behavior after you configure to check availability of the resource, when you try to save the booking, it will prompt the dialog box when there is a conflict.



You will noticed that there are two buttons "Don't save" and "Save Anyway" that do not make sense to allow users to save if there is conflict. 

Well, there is a way to remove these two buttons and here are the details. There are three places you need to make the change. The URLs are listed below for list named "PCP Booking 2".

Go to "Settings" -> "Edit the page" and find the "SharePoint|sapiens Calendar E-Mail Extension Client Script" webpart->Click "EDIT SNIPPET".


Then append the following script to hide two buttons. Click "Insert" and save the page.

      <style type="text/css">
      input[value='Save Anyway'] { display: none; }
      input[value="Don't save"]  { display: none; }
      input[value="Don't save"] + input[value='Save'] { display: none; }

      </style>


5. The sixth optional step you might want to do prevent users to create past event.You could configure this in the lsit Validation setting.

Click the list settings->Validation settings. Enter the following formula to prevent past event to be created.

=[End Time]>Created



You could use another formula to prevent the past event to be modified.

=[End Time]>Now() 

5. The seventh optional step you might want to allow user to edit their events created by themselves.

You can go into the List SettingsAdvanced Settings, and you should be able to set Read and Edit access to items that the user has created.




Now the  "Calendar E-mail Extension for Office 365" apps is ready on the SharePoint online site.




Tuesday, July 16, 2019

Easy way to hide SharePoint online event list some fields like “All Day Event” and “Recurrence”

When we create a new calendar that is an event list  on SharePoint online site, as default it will display fields like  "All Day Event" and "Recurrence" as in the below screenshot. In some cases, you may not want these fields and here are different ways to hide them.



1. The most common way is to use SharePoint designer to create new form and then remove the fields in the advanced design. This has been described here in details.

The major challenge is the designer is not reliable toll and you might constantly get the following error "could not save the list changes to the server" like discussed here. I'm always getting this error and could not resolve it quickly. This is the way I would NOT recommend you to try!

2. The second way is to use Powershell to set the fields like described here. The key Powershell command is like below.

    $field = $list.Fields["FieldName"]
    $field.ShowInNewForm = $false
    $field.Update()
However, I'm not able to find the equivalent PnP SharePoint online command. If you do, please let me know. This Powershell command seems only works for SharePoint on-premises.

3. The third way is to use the OoB UI with few tricks. Here is the details.
  • Go to "List Settings" -> Advanced settings" -> Set “Allow management of content types?” to “Yes”.
  • Click the content type used in the event list and click one field with link like “Category”. You will be able to make the field “Hidden”. 
  • Two fields like “All Day Event” and “Recurrence” do not have direct link you could modify. You should copy the URL from previous "Category" field like this.


  • You could now remove the "Fid" Parameter and replace "Field" Parameter value with either "fRecurrence" or "fAllDayEvent". 




Please note if you hide the “All Day Event”  on the content type as in method #3, the calendar cannot be displayed in the event webparts! The events will be empty.

4. The forth way is to use the javascript if this is allowed on the SPO site. Here is the details.

Add a content editor webpart on respective pages (NewForm.aspx/ DispForm.aspx/ EditForm.aspx) and use below jQuery code to hide SharePoint field. 

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$('nobr:contains("Category")').closest('tr').hide(); //here we are hiding field named "Category"
$('nobr:contains("All Day Event")').closest('tr').hide(); //here we are hiding field named "All Day Event"
$('nobr:contains("Recurrence")').closest('tr').hide(); //here we are hiding field named "Recurrence"
});
</script>
This method will hide the fields and still allow the event webpart to display the calendar events. However, this is only applicable when script is allowed on the site. If not, you could enabled it.

Now you should be able to hide  “All Day Event” and “Recurrence” along with other fields you want to hide from end users.

There should be other ways like Rest/Graph API to hide, or may be SPFx customization you can try.