none
Bing Maps V8 and SharePoint 2013 RRS feed

  • Question

  • Hello,

    I'm trying to upgrade application code from V7 to V8, and managed to have it working with less code than before (great!).

    But my problem is the script link to include v8 map control breaks SharePoint 2013 Ribbon...

    More precisely, it generates an error in inplview.js (Expected ';') on : eval("ctxT = ctx"+g_ViewIdToViewCounterMap[vid]+";")

    The symptoms after that is that any call to SP.ListOperation.Selection.getSelectedItems() fails with "Unable to get property 'toString' of undefined or null reference".

    As soon as I remove the tag <script type='text/javascript' src='https://www.bing.com/api/maps/mapcontrol?branch=release&mkt=fr-ch&callback=loadMaps' async defer></script> everything works as expected...

    Am I missing something ? Or is V8 not SharePoint 2013 compatible yet?


    Lloyd, MCITP SharePoint Administrator 2010

    Wednesday, June 29, 2016 11:52 AM

Answers

  • Not sure what might be causing this. Is the call to the code that is breaking in the loadMaps function, or called from there? If so, it is possible that your code is executing faster than before and the SharePoint code isn't ready yet.

    Also, side note here, currently the mkt parameter is not supported in V8 and isn't really needed. V8 auto-detects the users culture settings from their browser. The default branch is the release branch, so it doesn't have to be explicitly set in the script URL. Makes, no difference, but saves a few characters :)


    [Blog] [twitter] [LinkedIn]

    Wednesday, June 29, 2016 4:47 PM
  • Try adding "&branch=experimental" to the map script URL.

    Also ensure that your page isn't running in compatibility mode as this would emulate IE5 which doesn't support HTML5.

    I just tested this in a version of SharePoint I have access to and it worked fine. How are you integrating Bing Maps with SharePoint?


    [Blog] [twitter] [LinkedIn]




    Tuesday, July 12, 2016 5:40 PM

All replies

  • Not sure what might be causing this. Is the call to the code that is breaking in the loadMaps function, or called from there? If so, it is possible that your code is executing faster than before and the SharePoint code isn't ready yet.

    Also, side note here, currently the mkt parameter is not supported in V8 and isn't really needed. V8 auto-detects the users culture settings from their browser. The default branch is the release branch, so it doesn't have to be explicitly set in the script URL. Makes, no difference, but saves a few characters :)


    [Blog] [twitter] [LinkedIn]

    Wednesday, June 29, 2016 4:47 PM
  • I also tried with only the tag <script type='text/javascript' src='https://www.bing.com/api/maps/mapcontrol'></script> and it also breaks the inplview.js script (and causes the above symptoms)...

    I think there is probably a naming collision or something like that between the Bing Maps and SharePoint...


    Lloyd, MCITP SharePoint Administrator 2010

    Thursday, June 30, 2016 6:09 AM
  • Strange, I'll try and run some test on my end to see if I can reproduce this. The SharePoint team has already been testing V8 out in new versions of SharePoint and haven't seen any issues yet.

    [Blog] [twitter] [LinkedIn]

    Thursday, June 30, 2016 6:29 PM
  • Thanks, we are currently using SharePoint 2013 (15.0.4753.1000).

    We have not the last CU (we will test it this summer), so I'll post an update if it solves the problem.


    Lloyd, MCITP SharePoint Administrator 2010

    Friday, July 1, 2016 5:47 AM
  • Also, running into this. Referencing the v8 api kills the user interface on the page. The map itself works fine but can't edit the page.

    Tuesday, July 12, 2016 10:31 AM
  • Try adding "&branch=experimental" to the map script URL.

    Also ensure that your page isn't running in compatibility mode as this would emulate IE5 which doesn't support HTML5.

    I just tested this in a version of SharePoint I have access to and it worked fine. How are you integrating Bing Maps with SharePoint?


    [Blog] [twitter] [LinkedIn]




    Tuesday, July 12, 2016 5:40 PM
  • I'll try the experimental branch in a few days and give a feedback (moreover I just installed SP2013 July CU)... though I fear that the meta <meta http-equiv="X-UA-Compatible" content="IE=10"> may cause some trouble with the HTML5 support.

    As for the "how", the map is added in the SharePoint ribbon (browse tab), after the page is loaded. The code that breaks has nothing to do with the loadmap function, it's when you try to select multiple items/documents in a view and click on any active ribbon button...


    Lloyd, MCITP SharePoint Administrator 2010

    Thursday, July 28, 2016 6:02 AM
  • I just tried the "branch=experimental" in my master page, but this does not change anything... as soon as I add <script type="text/javascript" src="</script">https://www.bing.com/api/maps/mapcontrol"></script> I have an error popping up in inplview.js...

    But, it seems to be a timing issue, though: if I let the IE debugger stop on first error (because of old version code), wait for 20s, then click "run" to continue debugging, I don't have any error from inplview.js...


    Lloyd, MCITP SharePoint Administrator 2010

    Wednesday, August 17, 2016 12:25 PM
  • Wrong assumption: waiting just postpones the error to the moment where you click on any ribbon butron that uses SP.ListOperation.Selection.getSelectedItems()...

    I tried to reproduce the problem on a standard install:

    1- add <script type="text/javascript" src="</script">https://www.bing.com/api/maps/mapcontrol?branch=release"></script> to Seattle.html

    2- create a custom button with a customaction that looks like:

     

    <CustomAction

        Id="..."

        Location="CommandUI.Ribbon"

        Title="Title">

        <CommandUIExtension>

          <CommandUIDefinitions>

            <CommandUIDefinition Location="Ribbon.Documents.Manage.Controls._children">

              <Button

                      Id="ButtonId"

                      Sequence="6"

                      Command="CustomCommand"

                      ... />

            </CommandUIDefinition>

           

          </CommandUIDefinitions>

          <CommandUIHandlers>

            <CommandUIHandler

              Command="CustomCommand"

              CommandAction="javascript:

                  var context = SP.ClientContext.get_current();

                  var items = SP.ListOperation.Selection.getSelectedItems(context);

                  var listId = SP.ListOperation.Selection.getSelectedList();

                  var itemId = items[0].id;"

              EnabledScript="javascript:SP.ListOperation.Selection.getSelectedItems().length == 1;" />

          </CommandUIHandlers>

        </CommandUIExtension>

      </CustomAction>

    3- Deploy custom action ans click on button

    --> Unable to get property 'toString' of undefined or null reference in sp.ribbon.js.

     


    Lloyd, MCITP SharePoint Administrator 2010

    Wednesday, August 17, 2016 2:01 PM
  • You have "</script>" in your URL. That would be an issue. Assuming that is a typo, I would recommend asynchronously loading the V8 control. Add on a callback function to the map script URL and add the words async defer to the script tag. For example:

    <script type="text/javascript" src="http://bing.com/api/maps/mapcontrol?callback=GetMap" async defer></script>

    Then, have your logic for loading the map in the callback function (i.e. GetMap).

    As for the previous recommendation of using experimental, the bug fixes in there were rolled into the main release branch a couple weeks ago, so you should be fine with the main release branch now. The experimental branch has had a few bug fixes and new features added since but they are likely not relevant to your app at this point.


    [Blog] [twitter] [LinkedIn]

    Wednesday, August 17, 2016 4:00 PM
  • Tested again this morning with these tags in a copy of Seattle.master:

    <script type="text/javascript" src="https://bing.com/api/maps/mapcontrol?callback=GetMap" async defer></script>

    <script type="text/javascript">
    function GetMap() {
              alert('Bing maps script included');
    }
    </script>

    And here is my ribbon:


    Lloyd, MCITP SharePoint Administrator 2010

    Thursday, August 18, 2016 8:39 AM
  • Not sure what to tell you. We can't reproduce this issue in SharePoint 2013. We do however see on the web that there are a ton of reports of issues with inplview.js which may be the root cause of your issue.

    [Blog] [twitter] [LinkedIn]

    Thursday, August 18, 2016 7:03 PM