Archive

Archive for the ‘Microsoft SharePoint’ Category

PowerApps : Move SharePoint custom list form to different site

December 18, 2023 Leave a comment

Hello Friends,

I recently done some modification to SharePoint list form in PowerApps, I done all modifications and tested it as well. Everything was as per expected but now i was having requirement to move this form to another list in different site. I thought it is very straight forward requirement but to my surprise, i do not found direct option to export it. I seen this export option was there previously but now Microsoft have removed it. As SharePoint custom list forms are not listed in apps list hence we can’t use the default export option, so now how to export the SharePoint custom list form built using PowerApps to another site inside same tenant?

There are two ways using which we can export the list form.

I have created a sample SharePoint list, where list form is modified.

Main parent list holding just Title values.

Parent List

Child list 1, holding reference using parent list ID column to Lookup_ID

Child List 1

Child list 2, holding reference using parent list ID column to Lookup_ID

Child List 2

I have modified the list form to just view values for current selected items and also using LookUp function matching value from list Child1PATest and Child2PATest list.

List Form view purpose

Option 1 –

  1. Open the custom SharePoint list form.
Open SP List Form in PowerApps studio
Open SP List Form in PowerApps studio

2. Press Ctrl+Shift+S

Ctlr+Shift+S

3. Click on the “Save” Option from the left menu and click on “See all versions”.

Save

Now you can see “Export package” option on the top.

Export Option

Option 2 –

  1. Go to List settings and click on ‘Form settings’
List Settings

2. Select “See versions and usage” option

Form Settings

3. Now you can see “Export package” option on the top.

Export Option from list settings

In upcoming post I will share how to migrate connections to different site. Sharing is caring.

Error while creating app catalog – Updates are currently disallowed on GET requests. To allow updates on a GET, set the ‘AllowUnsafeUpdates’ property on SPWeb

December 12, 2023 Leave a comment

Hello friends,

Recently after creating a dev tenant, I proceeded to create tenant level app catalog site as I was setting up the SPFX environment. I selected ‘Create a new app catalog site’ and added needed details.

New App Catalog Creation
New App Catalog Creation
New App Catalog details
New App Catalog details

I got an error “Updates are currently disallowed on GET requests. To allow updates on a GET, set the ‘AllowUnsafeUpdates’ property on SPWeb” when i tried to create a new catalog site.

New App Catalog Error
New App Catalog Error

After scratching head and after some googling, i found out that we need at least one site collection created other than the default site gets created with tenant. Then only new app catalog creation will work.

New Sample Site Creation
New Sample Site Creation

So, i have created a Test site and tried again to create new app catalog and voilà, it worked.

Looking like Microsoft should improve on error handling.

Sharing is caring.

SharePoint online: Error ‘Updates are currently disallowed on GET requests. To allow updates on a GET, set the ‘AllowUnsafeUpdates’ property on SPWeb’ while creating new app catalog site

July 6, 2020 2 comments

Recently I have created new E5 personal tenant for my development and testing purpose. I wanted to deploy and test the SPFx component in that tenant, hence I tried to create the App catalog.

I directly went to SharePoint admin center in Office 365 and tried to create new App catalog site, like following.

App catalog Creation

App catalog Creation

I got the error ‘Updates are currently disallowed on GET requests. To allow updates on a GET, set the ‘AllowUnsafeUpdates’ property on SPWeb’.

App catalog Creation Error

App catalog Creation Error

I initially thought that the error is due to some technical glitch and no clear reason of the error explained in error and hence I tried to create App catalog site couple of times more but no luck and got the same error.

The solution is bit weird as I just created new tenant, I do not have any site created yet and I jumped directly to create app catalog site.

Then I have created one test site in tenant.

One Site Created

One Site Created

And it worked, I again tried creating the App catalog site and it worked.

App Catalog Success

App Catalog Success

So we need to at least create one site before creating App catalog. The only concern is Microsoft should provide some meaningful error message so that we will not be confused.

Sharing is caring, stay safe. Take care.

Step by step installation of SharePoint Server 2019 preview for single server farm topology

July 26, 2018 1 comment

Hi Friends,

As we know that SharePoint Server 2019 and Project Server 2019 preview available, I was excited with this news and thought to have it installed on and check what’s now.
Following article will have instructions to install SharePoint Server 2019 preview on Azure VM.
Let’s start by creating the virtual machine on Windows Azure platform.
I have created a VM with image template ‘SQL Server 2017 Standard on Windows Server 2016’.

SP2019_Azure VM Image

I have chosen ‘Standard B4Ms’ sizes configuration.

SP2019_Azure VM

And created the VM, it have taken some time to get it created. Following are the configuration shown on the created VM on Azure.

Now as we have Virtual machine ready with SQL server 2017, we can start with SharePoint Server 2019 installation.
1. Let’s first download the setup from https://www.microsoft.com/en-us/download/details.aspx?id=57169
2. I have chosen ‘en-us\16.0.10711.37301_OfficeServer_none_ship_x64_en-us_dvd\officeserver_en-us.img’ installation language for downloading installation, its 3.8GB size.

Download SharePoint Server

3. Click Save to copy the disc image file to your computer.
4. Right click on the ‘officeserver_en-us.img’ file and select Mount option.

Mount_Image

5. Navigate to the mounted drive.
6. Run splash.hta to launch the SharePoint Server 2019 Start page.
7. Click Install software prerequisites to launch the Microsoft SharePoint 2019 Products Preparation Tool.

SP2019_1

8. Follow the instructions in the tool to complete the installation of the software prerequisites.

SP2019_2

9. Select ‘Finish’ to restart the server and complete the installation of prerequisites.
10. After restart if the image file not mounted automatically then repeat step 4,5 and 6 to run the splash.hta file.
11. On the SharePoint Server 2019 Start page, click ‘Install SharePoint Server’ to launch Microsoft SharePoint Server 2019 Public Preview Setup.

SP2019_3

12. When prompted, provide a product key. You can use the trial product key from article install instructions section. The trial period is 180 days. You can convert to a licensed installation at any time during the trial or after the trial has expired by entering the appropriate product key in Central Administration.

SP2019_4

13. Sit back and relax to complete the installation.

SP2019_5

SP2019_6

14. After completing the setup SharePoint Product configuration wizard will be started.

SP2019_7

15. Select ‘Yes’ at the following screen.

SP2019_8

16. As we are creating new farm, select as below screen shot.

SP2019_9

17. Select Next on below screen.

SP2019_16

18. In next screen we need to provide DB server details and Database access account details.

SP2019_11

19. After giving user details using which we have created the VM,I was getting following error “The specified user is a local account. Local accounts should only be used in stand alone mode.

SP2019_12

20. I thought we need to create a SQL user and pass that to continue the setup.
21. Hence I connected to SQL server management studio.

SP2019_13

22. I have created a new SQL user.

SP2019_14

23. And granted all the roles to that account.

SP2019_15

24. Now selected the newly created user also not helping me and giving same error as given in step no 19.
25. After that I have tried creating the new local user account and added that to Local administrator group and using those user in SQL. This also not helped me and I got stuck for some time.
26. After searching for the error we came across SP 2016 post when the solution was described to use the New-SPConfigurationDatabase cmdlet.

 

New-SPConfigurationDatabase -DatabaseName SharePoint_ConfigDB -DatabaseServer [ServerName] -AdministrationContentDatabaseName SharePoint_ContentDB -Passphrase (ConvertTo-SecureString [password] -AsPlaintext -Force) -FarmCredentials (Get-Credential) -localserverrole SingleServerFarm

27. Please read about at cmdlet New-SPConfigurationDatabase , I used ‘SingleServerFarm’ option for localserverrole parameter as I am installing on single server.
28. This command will take some time and create configuration database.
29. After successful completion run the SharePoint product configuration wizard again.

SP2019_16

30. This time it got succeed and we are able to proceed.

SP2019_17

31. Click Next to continue with configuration. And wizard will continue as following.

SP2019_18

SP2019_19

32. Now the final configuration task started and installation continued.

SP2019_20

33. Installation success message shown as following.

SP2019_21

34. Now we can able to access SharePoint central administration.

SP2019_22

We can now free to create web application and site collection. Modern site templates are available at ‘Template selection’ step.

Hope this article will help to save some valuable time while setting up SharePoint 2019 preview.
Thanks for Reading.

SharePoint online / SharePoint 2013: Sharing variable values between search control and display templates

November 29, 2017 Leave a comment

Recently I came across to a scenario where I need to set the variable in control template and the value of the variable should be accessible in item template and vice versa.
I was showing some data in item templates and using third party pagination for displaying the search result, needed the value of pagination size which is available in control template.
I tried with normal JavaScript variable but due to the scoping in display template it was not available for me inside the item template.
Solution 1:
We can use Windows.variable which is nothing but global variable creation on the scope of the window object and hence will be accessible throughout the scope of windows object.
Control Template:

<!--#_ window.PageSize = "30"; _#-->

Item Template:

<!--#_ alert(window.PageSize); _#-->

Solution 2:
Another better alternative is to use the built-in ctx object which is already shared between the control and item display template.
Control Template:

<!--#_ ctx.PageSize = "30"; _#-->

Item Template:

<!--#_ alert(ctx.PageSize); _#-->

Happy learning.

SharePoint 2013: Creating and calling custom JavaScript function in search display template

October 23, 2017 Leave a comment

Hi Friends,

Recently I came across a requirement where I need to create a custom JavaScript function which will change the date formatting on the provided string date parameter.

I tried creating normal JavaScript function in display template and tried calling it from other part of template but the function was undefined and not found inside the display template, I got little bit confused as I have created the JavaScript function in same display template but still not able to find it in same display template while calling. We can have couple of ways to resolve the issue.

Solution 1:

After some googling I found the cause of the issue and the solution as well, as follows.

The possible reason is scoping of the display template not allowing to consider external JavaScript function as a part of the scope to call inside display template.

The solution is to create new function on window scope and the call it in the desired place inside display template.

window.MyTestFunction = function(myParam)
{
// your own logic to work on the param 'myParam'
}

Calling the function:

<a style="cursor:pointer" onclick='window.MyTestFunction(3)'>Call My custom JS function</a>

Solution 2:

  1. Create a JavaScript file (MySampleJS.js) in the Display Templates/Search folder.
  2. Add the custom JS function in to the MySampleJS.js file.
  3. Add the following code into thetag below to include the JS file in display template
<script>
$includeScript(this.url, "~sitecollection/_catalogs/masterpage/Display Templates/Search/ MySampleJS.js");
</script>

Happy learning.

SharePoint 2013: Converting GMT/UTC time to local time in XSLT for rendering RSS feed

September 28, 2017 Leave a comment

Hi Friends,

Recently I came across the requirement where the date coming from RSS feed which is in GMT format needed to be converted to local time and display in required format.

As RSSAggregatorWebPart webparts executes on server side and renders the output html in browser, we cannot utilize the rss date to convert to local date.

I tried multiple solution with default XSLT for calling JavaScript function, like CDATA, xsl:comment and try adding script tag but none worked for me.

Finally after struggling I found a way to achieve desired result using onerror handler with img tag.

Solution as fallows –

XSLT changes

Add following section in XSLT, which actually uses the img tag to call the JavaScript function using on error event.

Rss1

JavaScript changes

Following function we needed to add a separate JS file which will be referred in the master page or add in master page itself and make sure it that JS method gets loaded before the method call in XSLT.

function ConverDateToLocal(pDate, sender) {
    try {
        var today = new Date(pDate);
        var dd = today.getDate();
        var mm = today.getMonth() + 1; //January is 0!
        var yyyy = today.getFullYear();
        var hh = today.getHours();
        var mmm = today.getMinutes();
        /*if(dd<10) {
            dd='0'+dd
        } 

        if(mm<10) {
            mm='0'+mm
        } */
        var restStr = dd + '.' + mm + '.' + yyyy + " " + hh + ":" + mmm;
        if (sender != null) {
        var senderid = sender.id;
        if (senderid) {
        var senderidsplit = senderid.split('_');
        if (senderidsplit.length > 0) {
                    var datedivid = "datediv_" + senderidsplit[1];
                    if (datedivid) {
                        var datediv = document.getElementById(datedivid);
                        if (datediv != null) {
                            datediv.innerHTML += " :: " + "New ::" + restStr;
			                // After testing folling code should be execuated
			                //datediv.innerHTML = restStr;
                        }
                    }
                }
            }
        }
    }
    catch(err) {}
}

After applying the XSLT we can see the output like following where first date is GST date and next date is converted local date.

RSS3

Happy coding.

SharePoint: How to check if page is in edit mode or not in JavaScript

August 28, 2017 Leave a comment

As SharePoint evolved and other client technologies started to become popular and independent we are achieving most of the solution with client side technologies like JavaScript, jQuery and other similar.

I came across one requirement while working on a JavaScript based component, where I need a conditional code to run only when my page is in edit mode. I found multiple solutions which I summaries below.

Option 1:

var inDesignMode = document.forms[MSOWebPartPageFormName].MSOLayout_InDesignMode.value;
if (inDesignMode == "1")
{
// page is in edit mode
}
else
{
// page is in browse mode
}

For Wiki pages

var wikiInEditMode = document.forms[MSOWebPartPageFormName]._wikiPageMode.value;
if (wikiInEditMode == "Edit")
{
// wiki page is in edit mode
}
else
{
// wiki page is not in edit mode
}

Option 2: Using SP.Ribbon.PageState.Handlers.isInEditMode()

ExecuteOrDelayUntilScriptLoaded(function(){
var InEditMode = SP.Ribbon.PageState.Handlers.isInEditMode();
if(InEditMode){
// page is in edit mode
}
}, 'SP.Ribbon.js');

Option 3: While checking the value in SharePoint search display template we need to use Srch.U.isPageInEditMode Method

var isRollupPageInDisplayMode = Srch.ContentBySearch.isRollupPage(ctx.ClientControl) && !Srch.U.isPageInEditMode();

Happy Learning!