Showing posts with label SharePoint Designer 2010. Show all posts
Showing posts with label SharePoint Designer 2010. Show all posts

Friday, February 23, 2018

SharePoint Designer 2010: Cannot load C:\PROGRA...\fpsrvutl.dll

Problem

The problem involved attempting to install SharePoint Designer 2010 (32-bit) to Microsoft Windows 7 hosted on a VMware Horizon Client.  The first issue encountered occurred during installation, when the installation routine was unable to find and install a component. After working through this problem, a new one was encountered that occurred when attempting to launch the product. This posting documents the troubleshooting steps taken and the solution that was found to this problem.

Troubleshooting

  1. Action: Attempted to install SharePoint Designer 2010 (32-bit) onto Windows 10. 
    1. Result: installation failed due to inability to the inability to find a needed component.
      SharePoint Designer requires the following component to be installed: Microsoft .NET Framework Version 3.5 SP1.
    2. Research: Checking Windows 10 installed features verified that .NET Framework 3.5 was not installed:
      .
  2. Action: attempted to install .NET Framework 3.5. This required files to be downloaded.
    1. Result: Windows was unable to find the required files to complete the request changes. Error code: 0x800F081F.
      .
    2. Research: searched for and found related reference; error code indicated that there was a path problem for Windows to find needed files.  However, no option was provided during the download process for indicating a path, which suggest that this option was locked down by GPO.  Rather than engage in paperwork delays, it was suggested to try a Windows 7 VMware Horizon client.
  3. Action: attempted installation of SharePoint Designer 2010 (32-bit) onto Windows 7 (64-bit) on VMware Horizon client.
    1. Result: During installation, experienced Error 1712, One or more of the files required to restore your computer to its previous state could not be found.  Restoration will not be possible.  Setup failed. Rolling back changes...
      .
    2. Research: one post seemed to indicate that a simple re-installation attempt might work, after performing a reboot of the machine.  
  4. Action: rebooted machine and then attempted re-installation.
    1. Result: succeeded.
  5. Action: attempted to launch SharePoint Designer 2010 (32-bit).
    1. Result: experienced new error, Cannot load "C:\PROGRA~2\COMMON~1\MICROS~1\Web Server Extensions\14\BIN\fpsrvutl.dll".
      .
    2. Research: one post seemed to indicate that there might be an incompatibility with Office 2016.  Spoke with VMware Horizon Administrator, who confirmed that Office 2016 is installed to new Windows 7 clients bey default.  The administrator then redeployed the client without Office 2016 installed.
  6. Action: attempted to uninstall SharePoint Designer 2010 (32-bit).  
    1. Result: The uninstallation completed but with an error: Microsoft SharePoint Designer 2010 uninstall did not complete successfully.
      .
    2. Research: found one posting that led to discovery of a Microsoft tool for removing Office from a machine.
  7. Action: used tool to attempt to remove all Office components and artifacts from Windows 7 client.
    1. Result: successful.
  8. Action: performed re-installation of SharePoint Designer 2010 (32-bit).
    1. Result: Successful.
  9. Action: attempted to launch Designer again.
    1. Result: experienced new error, Cannot load "C:\PROGRA~2\COMMON~1\MICROS~1\Web Server Extensions\14\BIN\fpsrvutl.dll".
    2. Research: checking machine logs, found a number of warnings concerning the inability to modify various registry keys and subkeys. One posting seemed to indicate that perhaps installed AV was preventing access.  Discussed this with VMware Horizon administrator who indicated that a Windows 7 client could be deployed that did not have AV installed.  Checking the permissions for these keys found that the identity under which the modification was being performed was the identity of the user that performed the installation and attempted to launch SPD2010.  Verified that this identity was a member of the local Administrators group.  Checked the permissions of the local Administrators group for the listed registry keys and subkeys and found that this group only had READ permission for each and every listed key.
  10. Action: performed installation of SharePoint Designer 2010 (32-bit) onto new Windows 7 client that did not have Office of AV installed.
    1. Result: successful.
  11. Action: attempted to launch SPD2010 on new client.
    1. Result: experienced same error as previously, Cannot load "C:\PROGRA~2\COMMON~1\MICROS~1\Web Server Extensions\14\BIN\fpsrvutl.dll".
    2. Research: given the nature of the warnings, it was determined that perhaps modifying the permissions of the listed registry keys and subkeys so as to grant the local Administrators group full control would resolve the launch issue.
  12. Action: changed ownership of each of the listed keys to the local administrators group, and then granted the local Administrators group Full Control; and then attempted to launch SPD2010 - again on new client.
    1. Result: same error as previously.
    2. Research: reviewing the machine log, found same warnings.  Then determined that granting the local Administrators group Full Control to each of the registry hives might resolve the issue.
  13. Action: changed ownership of each of the hives containing the listed keys to the local Administrators group, and then changed the permission granted to the local Administrators group to Full Control.  Then tried re-installing and re-launching on new client
    1. Result: successful installation but launching failed with usual error.
    2. Research: discussed with other staff members who did have SharePoint Designer 2010 successfully installed.  Checked their installation files against the one that was used and found significant difference in size.  Checking this further found that the version used by other staff members was 64-bit version.  This suggested that perhaps 64-bit version might be successfully installed and operated on Windows 7 VMware Horizon client.
  14. Action: completely removed SharePoint Designer 2010 (32-bit) from Windows 7 VMware Horizon original client (used previously in steps 3 - 9).  Performed fresh install, which was successful.  Then attempted to launch.
    1. Result: SharePoint Designer 2010 (64-bit) successfully launched and was able to successfully connect to sites.

Solution

  • On Windows 7 VMware Horizon clients, install 64-bit version of SharePoint Designer 2010.

References

  • Listing of all warnings found in Application log:
    • \Software\Classes\Interface\{85AEE342-48B0-4244-9DD5-1ED435410FAB}\TypeLib
    • \Software\Classes\Interface\{85AEE342-48B0-4244-9DD5-1ED435410FAB}\TypeLib
    • \Software\Classes\Interface\{85AEE342-48B0-4244-9DD5-1ED435410FAB}\ProxyStubClsid3
    • \Software\Classes\Interface\{85AEE342-48B0-4244-9DD5-1ED435410FAB}\ProxyStubClsid
    • \Software\Classes\Interface\{85AEE342-48B0-4244-9DD5-1ED435410FAB}
    • \Software\Classes\Interface\{1BB5DDC2-31CC-4135-AB82-2C66C9F00C41}\TypeLib
    • \Software\Classes\Interface\{1BB5DDC2-31CC-4135-AB82-2C66C9F00C41}\ProxyStubClsid32
    • \Software\Classes\Interface\{1BB5DDC2-31CC-4135-AB82-2C66C9F00C41}\ProxyStubClsid
    • \Software\Classes\Interface\{1BB5DDC2-31CC-4135-AB82-2C66C9F00C41}
    • \Software\Classes\Interface\{2DBEC0A7-74C7-4B38-81EB-AA8EF0C24900}\TypeLib
    • \Software\Classes\Interface\{2DBEC0A7-74C7-4B38-81EB-AA8EF0C24900}\ProxyStubClsid32
    • \Software\Classes\Interface\{2DBEC0A7-74C7-4B38-81EB-AA8EF0C24900}\ProxyStubClsid
    • \Software\Classes\Interface\{2DBEC0A7-74C7-4B38-81EB-AA8EF0C24900}
    • \Software\Classes\Interface\{5DE00405-F9A4-4651-B0C5-C317DEFD58B9}\TypeLib
    • \Software\Classes\Interface\{5DE00405-F9A4-4651-B0C5-C317DEFD58B9}\ProxyStubClsid32
    • \Software\Classes\Interface\{5DE00405-F9A4-4651-B0C5-C317DEFD58B9}\ProxyStubClsid
    • \Software\Classes\Interface\{5DE00405-F9A4-4651-B0C5-C317DEFD58B9}
    • \Software\Classes\TypeLib\{56D04F5D-964F-4DBF-8D23-B97989E53418}\1.5\0\win32
    • \Software\Classes\TypeLib\{56D04F5D-964F-4DBF-8D23-B97989E53418}\1.5\HELPDIR
    • \Software\Classes\TypeLib\{56D04F5D-964F-4DBF-8D23-B97989E53418}\1.5\FLAGS
    • \Software\Classes\TypeLib\{56D04F5D-964F-4DBF-8D23-B97989E53418}\1.5
    • \Software\Classes\CLSID\{8854F6A0-4683-4AE7-9191-752FE64612C3}\InprocServer32
    • \Software\Classes\CLSID\{8854F6A0-4683-4AE7-9191-752FE64612C3}\TypeLib
    • \Software\Classes\CLSID\{3050F667-98B5-11CF-BB82-00AA00BDCE0B}\InprocServer32
    • \Software\Classes\CLSID\{3050F819-98B5-11CF-BB82-00AA00BDCE0B}\InprocServer32
    • \Software\Classes\CLSID\{AE24FDAE-03C6-11D1-8B76-0080C744F389}\InprocServer32
    • \Software\Classes\CLSID\{25336920-03F9-11CF-8FD0-00AA00686F13}\InprocServer32
    • \Software\Classes\CLSID\{3050F391-98B5-11CF-BB82-00AA00BDCE0B}\InprocServer32
    • \Software\Classes\TypeLib\{00020430-0000-0000-C000-000000000046}\2.0
    • \Software\Classes\CLSID\{0BE35204-8F91-11CE-9DE3-00AA004BB851}\InprocServer32
    • \Software\Classes\CLSID\{0BE35203-8F91-11CE-9DE3-00AA004BB851}\InprocServer32
    • \Software\Classes\TypeLib\{2A75196C-D9EB-4129-B803-931327F72D5C}\2.8
    • \Software\Classes\Interface\{BEF6E003-A874-101A-8BBA-00AA00300CAB}\TypeLib
    • \Software\Classes\Interface\{BEF6E003-A874-101A-8BBA-00AA00300CAB}\ProxyStubClsid32
    • \Software\Classes\Interface\{BEF6E003-A874-101A-8BBA-00AA00300CAB}\ProxyStubClsid
    • \Software\Classes\Interface\{BEF6E003-A874-101A-8BBA-00AA00300CAB}

Wednesday, February 5, 2014

SharePoint 2010 List Forms: Recover the default list or document library edit form

Problem

The default OOTB edit form for a particular document library (or for any list for that matter) has been lost, revised, edited, or whatever, such that the form no longer features the standard default List Form Web Part.  This is the list form web part (LFWP) that only displays the three fields, like so:
Because of these changes, certain fields are no longer displayed or displayed in a way such that they are not as usable as before.  For example, the Name field may display the filename now only as a read-only text, and not in an editable text box.  Other fields may not even be displayed.  There may also be a break between the ability to change column ordering using the features on the document library's or list's Settings page.  Whatever the case may, you want to get the original OOTB edit form back.  Here's how.  You'll need SharePoint Designer 2010 to do it.

Solution
  1. Launch SharePoint Designer 2010.
  2. Connect to the target site.
  3. On the Navigation pane, at left, click Lists and Libraries.
  4. On the Results pane, click on the target list or library.  The Results pane will change to show the properties and objects associated with the list or library you clicked.
  5. Look for the Forms group.  It will list all of the New, Edit and View forms created for this list or library.  If this is for a library, you will also see an Upload form item listed there too.
  6. Click the New... button for this group.
  7. Enter a name for this new default edit form, and the select the Edit item form option.
  8. Click OK.
  9. This dialog will close and a new edit form will appear listed in the Forms group.
  10. Click this item to open it in edit mode.  What you will see is all of the fields layed out nicely.  This is the DataForm Web Part.  You don't want this.
  11. Click anywhere in this form.  You'll see the DataFormWebPart title appear just above this form.
  12. Select this title.  This then selects the entire web part.
  13. Click the Delete key.
  14. Click anywhere inside the now empty web part zone.
  15. Up above, select the Insert ribbon.
  16. In the Controls group, click the SharePoint item.  A dropdown will open.
  17. Click List Form..., down at the bottom.  The List or Document Library Form dialog appears.
  18. Select the target list or document library, and then select the Edit item form option.  Leave the Show standard toolbar option checked.
  19. Click OK.  This inserts the LFWP onto the page.
  20. Save the page.
  21. On the Forms group, select the new edit form listed there (don't click on the filename itself).  This updates the ribbon.
  22. On the ribbon, select the Forms tab.
  23. Click the Set as Default button.
  24. Test.
References

Monday, January 13, 2014

SharePoint Designer 2010: This page cannot be edited in SharePoint Designer

Problem

You connect to a SharePoint 2010 farm site through SharePoint Designer 2010 in order to edit a page at the site.  After successfully connecting to the site and checking out the page, when you then click the Edit link, you experience this prompt:
Solution
  1. On seeing this prompt, click Cancel.
  2. Undo the checkout.
  3. Go to a list view of the pages
  4. Select the page.
  5. On the All Files ribbon, click the Detach from page Layout button.
  6. Proceed to edit as normal.
References

Thursday, October 17, 2013

How to implement flyout menus in the SharePoint 2010 global navigation

Introduction

This posting walks through the process of implementing flyout menus in the SharePoint 2010 global navigation.  It integrates the discussions presented in other postings on this subject (see discussions in the references below).  This process involves five critical steps:
  1. Modify MasterPage TopNavigationMenuV4 and TopNavigationDataSource controls
  2. Activate Publishing Infrastructure feature
  3. Build web application site topology
  4. Activate site SharePoint Server Publishing feature
  5. Configure global navigation
Each of these steps is critical to fully implementing flyout menus.  Failure to implement any step will result in an inconsistent or even complete lack of user experience. Each of these steps and details will be presented here. All references used in helping develop this posting are listed in the References section, below.  This posting assumes a web application having a single site collection.  Successful completion of this procedure will require Administrative rights to the root site and to all subsites; and it will require SharePoint Designer permissions to the root site.

Step 1: Modify MasterPage
  1. Launch SharePoint Designer 2010.
  2. Connect to the root site on the target web application.
  3. On the Navigation panel, at left, select Master Pages.  The Results panel at right updates to display a list of all Master pages for the site collection.
  4. Select the default master page, v4.master, and then make a copy of this, giving it a unique name.  For this posting, the copy is named v4_copy.master.
  5. Select this copy, and then click the Check Out button on the Master Pages ribbon, above.  A check appears next to v4_copy.master:
  6. On the Master Pages ribbon, click the Edit File button.  The Results panel is updated to display the file contents.
  7. On the View tabs, at bottom, click the Code view tab.  The Results panel is updated to display the page markup.
  8. In Code view, search for TopNavigationMenuV4.  This is the ID for the SharePoint ASP.NET global navigation control.  By default, it will look like so:
    <SharePoint: AspMenu
      ID="TopNavigationMenuV4"
      Runat="server"
      EnableViewState="false"
      DataSourceID="topSiteMap"
      AccessKey="<%$Resources:wss,navigation_accesskey%>"
      UseSimpleRendering="true"
      UseSeparateCss="false"
      Orientation="Horizontal"
      StaticDisplayLevels="2"
      MaximumDynamicDisplayLevels="1"
      SkipLinkText=""
      CssClass="s4-tn"/>
    
  9. Edit the following parameters of this control to a value that will encompass all of your subsites and sub-subsites:
    • MaximumDynamicDisplayLevels: 5.
  10. After modifying this parameter, the control markup will look like this (highlighted item is modified):
    <SharePoint: AspMenu
      ID="TopNavigationMenuV4"
      Runat="server"
      EnableViewState="false"
      DataSourceID="topSiteMap"
      AccessKey="<%$Resources:wss,navigation_accesskey%>"
      UseSimpleRendering="true"
      UseSeparateCss="false"
      Orientation="Horizontal"
      StaticDisplayLevels="2"
      MaximumDynamicDisplayLevels="5"
      SkipLinkText=""
      CssClass="s4-tn"/>
    
  11. In Code view, perform a search for TopNavigationDataSource.  This is the ID for the delegate control that defines the region for the global navigation bar.  By default, it looks like this (highlighted items are edited):
    <SharePoint: DelegateControl runat="server" ControlId="TopNavigationDataSource" Id="topNavigationDelegate">
        <Template_Controls>
            <asp:SiteMapDataSource
              ShowStartingNode="False"
              SiteMapProvider="SPNavigationProvider"
              id="topSiteMap"
              runat="server"
              StartingNodeUrl="sid:1002"/>
        </Template_Controls>
    </SharePoint: DelegateControl>
    
  12. Edit the following parameters of this control, like so:
    • ShowStartingNode="True"
    • SiteMapProvider="SPSiteMapProvider"
  13. Then completely remove this parameter:
    • StartingNodeUrl="sid:1002
  14. After making these modifications, the TopNavigationDataSource configuration will look like so:
    <SharePoint: DelegateControl runat="server" ControlId="TopNavigationDataSource" Id="topNavigationDelegate">
        <Template_Controls>
            <asp:SiteMapDataSource
              ShowStartingNode="True"
              SiteMapProvider="SPSiteMapProvider"
              id="topSiteMap"
              runat="server"
              />
        </Template_Controls>
    </SharePoint: DelegateControl>
    
  15. Save the file.
  16. Close Code view.
  17. Check the master page back in.
  18. Close SharePoint Designer 2010.
Step 2: Activate SharePoint Server Publishing Infrastructure
  1. Launch a browser and connect to the root site of the web application for which you want to implement flyout menus.
  2. Go: Site Actions > Site Settings > Site Collection Administration > Site collection features.  The browser is navigated to the Features page.
  3. Scroll down this page until you find the SharePoint Server Publishing Infrastructure feature.  By default, after building the farm, this feature will be deactivated.
  4. Click the Activate button for this feature:
  5. Close the browser or tab connected to Central Administration.
  6. This completes this step.
Step 3: Build site topology
  • In the target web application, build out the desired topology of sites, subsites, and sub-subsites.
Step 4: Activate site SharePoint Server Publishing feature
  1. Navigate to the root site.
  2. Go: Site Actions > Site Settings > Site Actions > Manage site features.  The browser is navigated to the site Features page.
  3. Scroll down to the SharePoint Server Publishing feature.  This feature becomes available, once SharePoint Server Publishing Infrastructure has been activated for the web application.
  4. Click the Activate button for this feature:
  5. Repeat steps 3.2 through 3.4 for each site and subsite that you want to include in the flyout menu system.
  6. This completes this step.
Step 5: Configure global navigation
  1. Navigate to the root site.
  2. Go: Site Actions > Site Settings > Look and Feel > Navigation.  The browser is navigated to the Navigation Settings page.
  3. In the Global Navigation section, enable the Show subsites option:
  4. This is the only configuration change that needs to be done.  Click OK.  The browser is navigated back to the Site Settings page.
  5. Repeat steps 5.2 - 5.4 for each site and subsite that needs to be included in the flyout menu system.  Once completed, all of the sites and subsites will appear in the appropriate flyout menu:
  6. This completes this step.
Optional: Add web pages (instead of sites) to the flyout menu
  1. Documents that are converted, as, for example, converting a Word document to HTML, using Word Automation Services, will be stored in the Pages folder of the site in which the conversion was performed.  These pages are automatically added to the flyout menu system. Additionally, files that you add to the Pages folder will also appear in the flyout menu system. 
  2. For example, in the screen capture below, the flyout menu option Website-Upgrade-Plan-1B2B is a file automatically converted to HTML and then published using Word Automation Services.  The second item (shaded) is merely an ASPX page uploaded to the same Pages folder:
Summary

This posting has presented a step-by-step walkthrough for how to implement flyout menus in the SharePoint 2010 global navigation.  It involves a series of five critical steps, each of which must be completed for the flyout menu experience to be consistent or to display at all.  This posting integrates the postings of previous bloggers on this subject who have discussed individual aspects of this process.

References
Notes
  • The ASP.NET TopNavigationMenuV4 control StaticDisplayLevels parameters sets the maximum level of the sites that will be dynamically displayed on the global navigation bar.  By default, this is set to 2, which means that by default, the global navigation will display a link to the root site of the site collection and all subsites to the site collection root.  Setting this to 1 will cause global navigation to only display a link to the root site collection.
  • Adding items to the Pages folder: note that items added to this folder will automatically appear in the flyout menus.  However, only ASPX pages, from my experience, open in the browser as web pages.  I haven't yet figured out why this is so.
  • New site or page does not appear in flyout menu: if you experience this, check the following:
    1. Verify that the SharePoint Server Publishing feature has been activated for this site.  This is very likely the root cause, if the site does appear on the flyout menu from the root site, but not at the target site - or it appears at other sites.
    2. Sometimes, newly created sites do not appear on the flyout menu, for reasons unknown - perhaps latency?  In any case, I have found that going to the root site, unchecking the Show subsites option, clicking OK, returning to the page, checking it again, and then clicking OK again, seems to resolve the problem.
  • Deleted site or page continues to appear in flyout menu: if you experience this, I have found that procedure 2, immediately above, to be useful to clear the flyout menu of the deleted site or page link.  It seems to cause SharePoint Server 2010 to rebuild the flyout menu system fresh.

Thursday, October 10, 2013

Cannot logon with credentials obtained from Secure Store Provider

Problem

You are working in SharePoint Designer 2010 and connected to the farm trying to add a new SQL Server connection in order to configure a new BCS service application.  At the SQL Server Connection dialog,
you enter the appropriate information, select Connect with Impersonated Windows Identity, enter the Secure Store Service target application ID, and click OK.  You then experience the following error:
This experience is repeatable.  You then attempt to add the connection by selecting Connect with User's Identity, and click OK.  You then experience the following error:
This result is repeatable.

Resolution

The second error message indicates the problem and its resolution: use an instance of SharePoint Designer 2010 that is installed to a machine within the same domain as the SharePoint Server 2010 farm.

References

Sunday, September 22, 2013

How to use SOAP to integrate SharePoint 2010 list data with jVectorMap

jVectorMap Series 
How to Build a Simple jVectorMap Display
How to integrate data with jVectorMap
How to customize jVectorMap region popups
How to add user interactivity to jVectorMap
How to add a popup modal to jVectorMap using Bootstrap
How to integrate jVectorMap with SharePoint 2010
How to use REST to integrate SharePoint 2010 list data with jVectorMap
How to use SOAP to integrate SharePoint 2010 list data with jVectorMap
Introduction

In the previous posting in this series, we explored how to use REST to integrate SharePoint 2010 list data with jVectorMap.  In this posting, we'll explore how to use SOAP to do the same thing.  This posting builds upon the previous posting, using the same site and file/folder structures.

Step 1: Preparation
  1. Add a new web part page to the SitePages folder.  For this posting, it is called map-soap.aspx.
  2. Add the quick launch to the page, as discussed here.
  3. Remove all the content in the PlaceHolderMain content placeholder.
  4. Add jQuery library version 1.9.0 to the site.  For this posting, it is placed in the jQuery folder located in the SitePages folder off the site root.
  5. Verify that a list is available for testing.  For this posting, the CountryData list is used.  This is the same list that was used in the previous posting to hold country data.
Step 2: Add SOAP template test script
  1. Copy and paste this template script in the PlaceHolderMain content placeholder:
    <script type="text/javascript" src="jQuery/jquery-1.9.0.js"></script>
    <script type="text/javascript">
     $(document).ready(function(){
       var soapEnv = "<soap:Envelope xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'> \
        <soap:Body> \
         <GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'> \
          <listName>CountryData</listName> \
          <query> \
           <Query> \
            <Where> \
             <Eq> \
              <FieldRef Name='Title'/><Value Type='Text'>US</Value> \
             </Eq> \
            </Where> \
           </Query> \
          </query> \
          <viewFields> \
           <ViewFields> \
            <FieldRef Name='Title' /> \
            <FieldRef Name='Data' /> \
           </ViewFields> \
          </viewFields> \
          <rowLimit>99999</rowLimit> \
          <queryOptions xmlns:SOAPSDK9='http://schemas.microsoft.com/sharepoint/soap/' > \
           <QueryOptions/> \
          </queryOptions> \
         </GetListItems> \
        </soap:Body> \
        </soap:Envelope>";
       jQuery.ajax({
        url: "/jvectormap/_vti_bin/lists.asmx",
        type: "POST",
        dataType: "xml",
        data: soapEnv,
        complete: ProcessListItems,
        contentType: "text/xml; charset=\"utf-8\""
       });
       function ProcessListItems(xData, status) {
        jQuery(xData.responseXML).find("z\\:row").each(function () {
         $("<li>" + $(this).attr("ows_Title") + " (" + $(this).attr("ows_Data") + ")</li>").appendTo("#CountryData");
        });
       };
     });
    </script>
    <ul id="CountryData"></ul>
    
Step: 3: Test template script
  • Open a browser and navigate to map-soap.aspx.  The item corresponding to US is displayed
Step 4: Modify script to retrieve all list items
  1. Review the script inserted above, and then find and remove this portion:
    <Where> \
      <Eq> \
        <FieldRef Name='Title'/><Value Type='Text'>US</Value> \
      </Eq> \
    </Where> \
    
  2. Refresh the browser connected to the map-soap.aspx page.  All of the list items are displayed
Step 5: Modify script to transform results into JSON array
  1. Add the following script library and CSS references just after the jQuery library reference added previously:
    <link href="jVectorMap/css/help.css" rel="stylesheet" type="text/css" media="all" />
    <script type="text/javascript" src="jVectorMap/js/jquery-jvectormap.js"></script>
    <script type="text/javascript" src="jVectorMap/js/jquery-mousewheel.js"></script>
    <script type="text/javascript" src="jVectorMap/lib/jvectormap.js"></script>
    <script type="text/javascript" src="jVectorMap/lib/abstract-element.js"></script>
    <script type="text/javascript" src="jVectorMap/lib/abstract-canvas-element.js"></script>
    <script type="text/javascript" src="jVectorMap/lib/abstract-shape-element.js"></script>
    <script type="text/javascript" src="jVectorMap/lib/svg-element.js"></script>
    <script type="text/javascript" src="jVectorMap/lib/svg-group-element.js"></script>
    <script type="text/javascript" src="jVectorMap/lib/svg-canvas-element.js"></script>
    <script type="text/javascript" src="jVectorMap/lib/svg-shape-element.js"></script>
    <script type="text/javascript" src="jVectorMap/lib/svg-path-element.js"></script>
    <script type="text/javascript" src="jVectorMap/lib/svg-circle-element.js"></script>
    <script type="text/javascript" src="jVectorMap/lib/vml-element.js"></script>
    <script type="text/javascript" src="jVectorMap/lib/vml-group-element.js"></script>
    <script type="text/javascript" src="jVectorMap/lib/vml-canvas-element.js"></script>
    <script type="text/javascript" src="jVectorMap/lib/vml-shape-element.js"></script>
    <script type="text/javascript" src="jVectorMap/lib/vml-path-element.js"></script>
    <script type="text/javascript" src="jVectorMap/lib/vml-circle-element.js"></script>
    <script type="text/javascript" src="jVectorMap/lib/vector-canvas.js"></script>
    <script type="text/javascript" src="jVectorMap/lib/simple-scale.js"></script>
    <script type="text/javascript" src="jVectorMap/lib/numeric-scale.js"></script>
    <script type="text/javascript" src="jVectorMap/lib/ordinal-scale.js"></script>
    <script type="text/javascript" src="jVectorMap/lib/color-scale.js"></script>
    <script type="text/javascript" src="jVectorMap/lib/data-series.js"></script>
    <script type="text/javascript" src="jVectorMap/lib/proj.js"></script>
    <script type="text/javascript" src="jVectorMap/lib/world-map.js"></script>
    <script type="text/javascript" src="jVectorMap/assets/jquery-jvectormap-world-mill-en.js"></script>
    <link href="jVectorMap/css/jquery-jvectormap.css" rel="stylesheet" media="all" />
    
  2. To the ProcessListItems function, add script to build JSON array from retrieved list data so that it looks like the following (additions highlighted):
    function ProcessListItems(xData, status) {
     var myString = "{";
     var mycdata;
     jQuery(xData.responseXML).find("z\\:row").each(function () {
      $("<li>" + $(this).attr("ows_Title") + " (" + $(this).attr("ows_Data") + ")</li>").appendTo("#CountryData");
      myString = myString + '"' + $(this).attr("ows_Title") + '":"' + $(this).attr("ows_Data") + '",';
     });
     myString = myString.substring(0, myString.length-1) + '}';
     mycdata = JSON.parse(myString);};
    
  3. Within the ProcessListItems function, just after the last statement in this function (in bold, below), add the jVectorMap script so that the entire function looks like the following:
    function ProcessListItems(xData, status) {
      
       var myString = "{";
       var mycdata;
       jQuery(xData.responseXML).find("z\\:row").each(function () {
        $("<li>" + $(this).attr("ows_Title") + " (" + $(this).attr("ows_Data") + ")</li>").appendTo("#CountryData");
        myString = myString + '"' + $(this).attr("ows_Title") + '":"' + $(this).attr("ows_Data") + '",';
       });
       myString = myString.substring(0, myString.length-1) + '}';
       mycdata = JSON.parse(myString);
       
       function chkValue(val){
         if (typeof val ==="undefined"){
           x = 0;
         }
         else{
           x = val;
         }
         return x;
       };
       $('#focus-single').click(function(){
         $('.map1').vectorMap('set', 'focus', 'SE');
       });
          
       //Reset focus
       $('#focus-init').click(function(){
         $('.map1').vectorMap('set', 'focus', 1, 0, 0);
       });
          
       //Clears all region colors
       $('#clear-map').click(function(){
         var map = $('.map1').vectorMap('get', 'mapObject');
         map.series.regions[0].clear();
       });
          
       $('#get-data').click(function(){
         alert(JSON.stringify(mycdata));
       });
       
       $('.map1').vectorMap({ 
         map: 'world_mill_en',
         //Set the initial focus to the center of the map
         //at the maximum zoom out
         focusOn: {
           x: 0.5,
           y: 0.5,
           scale: 1
         },
         series: {
           //this is the object for passing country/region data into
           regions: [{
             //define the range of color values
             scale: ['#DEEBF7', '#08519C'],
             //define the function that maps data to color range
             normalizeFunction: 'linear',
             //define the coloration method
             attribute: 'fill',
             //define the array of country data
             values: mycdata
           }]
         },
         onRegionLabelShow: function(event, label, code){
           label.html('<img src="/jVectorMap/CountryFlags/' + 
             code.toString() + '.png" /> ' + label.html() + 
             '<hr noshade="noshade" style="height: 1px"/>Count: ' + 
             chkValue(cdata[code]));
         }
       }); //closes jVectorMap
       
     }; //closes ProcessListItems
    
  4. Add the markup needed for the map container and interface elements:
    <!-- jVectorMap Container -->
    <div class="map1" style="width: 800px; height: 550px"></div>
    <!-- Set focus on Sweden  button -->
    <input id="focus-single" name="Button1" type="button" value="Focus on Sweden" />
    <!-- Reset map button -->
    <input id="focus-init" name="Button2" type="button" value="Reset Map" />
    <!-- Clear map button -->
    <input id="clear-map" name="Button3" type="button" value="Clear Map" />
    <input id="get-data" name="Button4" type="button" value="Get Data" />
    <!-- help button -->
    <div id="helpbtn"><a href="JavaScript:showHelpDialog();" class="helpDialog"><img src="jVectorMap/img/help.png" alt="Help" /></a></div>
    
  5. Save the page. 
  6. Open a browser and navigate to the page (or refresh).  The map is now displayed.  The same regions are colorized as in the previous posting:
  7. Add the script needed for the SharePoint modal popup.  Place it just above the JavaScript Ready function
    function showHelpDialog(){
      var options = {
        title: "jVectorMap help",
        width: 400,
        height: 600,
        url: "helpDialog.aspx" };
        SP.UI.ModalDialog.showModalDialog(options);
    };
    
  8. Lastly, remove the script and markup for generating the bulleted list.  Remove this script:
    $Query(xData.responseXML).find("z\\:row").each(function () {
      $("<li>" + $(this).attr("ows_Title") + " (" + $(this).attr("ows_Data") + ")</li>").appendTo("#CountryData");
      myString = myString = myString + '"' + $(this).attr("ows_Title") + '":"' + $(this).attr("ows_Data") + '",';
    });
    

    and then remove this markup:
    <ul id="CountryData"></ul>
    
  9. Save the page.
  10. Open a browser and connect (or refresh).  The markup no longer appears on the web page
Summary

In this posting, we have explored how to use SOAP methods to integrate SharePoint 2010 list data with jVectorMap.  This method uses the SharePoint 2010 SOAP service to retrieve data from a list.  For additional details on the topics discussed in this posting, see the references.

References
Notes
  • Has been tested successfully in this version.  Has been found not to work in version 1.9.1.  Other versions have not yet been tested.
  • Removing the CAML query causes the entire list to be retrieved.
  • The SharePoint modal popup will not work inside the jQuery Ready function.

Saturday, September 21, 2013

How to use REST to integrate SharePoint 2010 list data with jVectorMap

jVectorMap Series 
How to Build a Simple jVectorMap Display
How to integrate data with jVectorMap
How to customize jVectorMap region popups
How to add user interactivity to jVectorMap
How to add a popup modal to jVectorMap using Bootstrap
How to integrate jVectorMap with SharePoint 2010
How to use REST to integrate SharePoint 2010 list data with jVectorMap
How to use SOAP to integrate SharePoint 2010 list data with jVectorMap
Introduction

In the previous posting of this series, we explored how to migrate jVectorMap to the SharePoint 2010 platform.  In this posting, we will explore how to use REST to integrate SharePoint 2010 list data with jVectorMap.  The integration path involves: a SharePoint 2010 list, SharePoint 2010 REST services, jQuery, JSON, and jVectorMap.  By adding just a few lines of script to what has been developed thus far, we can extract list data into a JSON array and then pass this array into the series.region.values object in order to implement region coloration.   Building this integration path involves the following steps:
  1. Create the data list
  2. Identify REST svc URL
  3. Add data to the list
  4. Develop the script
  5. Test
The integration path presented here tested successfully using jQuery version 1.9.0. It did not test successfully with version 1.9.1.  Other versions have not yet been tested.

Step 1: Create the data list
  1. In SharePoint 2010, create a new list. Name the list without using spaces or non-CHARs so as to avoid HTML parsing changes. For this posting, the list is called CountryData. Leave the name of the Title field default. This field will contain the country digraph.
  2. Add a new field. Name the field without using spaces or non-CHARs in the name to avoid internal name conversion changes. For this posting, the new field is named Data.
Step 2: Identify REST service URL
  1. Open a browser, and then navigate to the site.
  2. Append the following to this URL: _vti_bin/listdata.svc, and then navigate to this URL
  3. Review the lists available via the REST interface. Append to the URL the name of the desired list. Note the capitalization.
  4. Append to this URL the querystring for selecting just the necessary fields from this list (note that meta information is still pulled even though its field, __metadata, (that's two underscores)is not specifically included):
    ?$select=Title,Data
  5. For this posting, the final URL is the following:
    ...[yoursite]/_vti_bin/ListData.svc/CountryData()?$select=Title,Data
    
Step 3: Add data to the list
  1. Add data to this list. For this posting, the same data used in previous postings is used for this one
  2. Open a browser and navigate to the URL obtained in the previous step. All of the list rows will appear:
Step 4: Develop the script
  1. First, modify the general jQuery function call so that script is executed after the DOM is ready. Change:
    (function () {
    
    to
    $(document).ready(function () {
    
  2. Define a variable for the REST service URL, and then enclose the script developed previously in a getJSON function
    var qryWCFUrl = "...yoursite/_vti_bin/ListData.svc/CountryData()?$select=Title,Data";
    $.getJSON(qryWCFUrl, function (results) {
    .
    .
    .
    });
    
  3. Add the script that:
    1. extracts the appropriate fields from the REST results,
    2. builds a key/value string from these results,
    3. parses the string into JSON format and
    4. loads it into an array.
    var mycdata;
    var myString = "{";
    $.each(results.d.results, function (i, item) {
     myString = myString + '"' + item.Title + '":"' + item.Data + '",';
    });
    myString = myString + '"ZZ":"1"}';
    mycdata = JSON.parse(myString);
    
  4. Change the variable used previously to pass data into the map, cdata, to the new variable, or mycdata, as used in this posting. Change:
    values: cdata
    to
    values: mycdata
  5. Optional: Add a click event handler that presents a popup of the stringified JSON data:
    $('#get-data').click(function(){
     alert(JSON.stringify(mycdata));
    });
  6. Optional: Add a button that the event handler binds to.
    <input id="get-data" name="Button4" type="button" value="Get Data" />
Step 5: Test
  1. Open a browser to the new page.  The results will appear identical
  2. Click on the new function button to see the stringified JSON data array
Final Script

Below is the final script that includes all of the modifications discussed above:

<script type="text/javascript" >    function showHelpDialog(){      var options = {        title: "jVectorMap help",        width: 400,        height: 600,        url: "helpDialog.aspx" };       SP.UI.ModalDialog.showModalDialog(options);    };    $(document).ready(function () {       var qryWCFUrl = "http://spdev12:4000/jVectorMap/_vti_bin/ListData.svc/CountryData()?$select=Title,Data"    $.getJSON(qryWCFUrl, function (results) {          var mycdata;     var myString = "{";     $.each(results.d.results, function (i, item) {      myString = myString + '"' + item.Title + '":"' + item.Data + '",';     });     myString = myString.substring(0, myString.length-1) + '}';     mycdata = JSON.parse(myString);        function chkValue(val){         if (typeof val ==="undefined"){           x = 0;         }         else{           x = val;          }         return x;       };              $('#focus-single').click(function(){          $('.map1').vectorMap('set', 'focus', 'SE');        });            //Reset focus        $('#focus-init').click(function(){          $('.map1').vectorMap('set', 'focus', 1, 0, 0);        });            //Clears all region colors        $('#clear-map').click(function(){        var map = $('.map1').vectorMap('get', 'mapObject');        map.series.regions[0].clear();        });            $('#get-data').click(function(){       alert(JSON.stringify(mycdata));     });       $('.map1').vectorMap({           map: 'world_mill_en',       //Set the initial focus to the center of the map       //at the maximum zoom out           focusOn: {             x: 0.5,             y: 0.5,             scale: 1           },       series: {            //this is the object for passing country/region data into        regions: [{               //define the range of color values         scale: ['#DEEBF7', '#08519C'],         //define the function that maps data to color range              normalizeFunction: 'linear',         //define the coloration method               attribute: 'fill',         //define the array of country data               values: mycdata             }]           },           onRegionLabelShow: function(event, label, code){            label.html('<img src="/jVectorMap/CountryFlags/' +             code.toString() + '.png" /> ' + label.html() +             '<hr noshade="noshade" style="height: 1px"/>Count: ' +             chkValue(cdata[code]));           }        }); //closes jVectorMap      }); //closes JSON      }) //closes jQuery function  </script>

Summary

In this posting, we have explored a simple method for extracting data from a SharePoint 2010 list,  and then ingesting this into the jVectorMap series.region object.  This integration path employed jQuery, JSON and REST services. Using this simple integration path, data in a SharePoint 2010 list can be used to support jVectorMap region coloration.  This method may also be used to support more complex integration, such as supporting region popups, marker placement and configuration and other solutions.

References
Notes
  • SharePoint Server 2010 Standard or Enterprise?  Either works for this.
  • REST vs. SOAP: the integration path presented here is much  simpler than that which would be necessary using SOAP methods.

Wednesday, September 18, 2013

How to integrate web parts using querystring methods


DashboardSeries
How to integrate web parts using query string methods
Introduction

This series of postings explores building dashboards for SharePoint Server 2010 using SharePoint Designer 2010. Over the course of these postings, we'll explore:
  • Some common web parts for displaying data
  • Using Query string and other methods for integrating and filtering data
  • Editing XML in order to customize web part data displays
  • Using PowerShell-based methods to analyze data
  • Cross-site data integration using web services
To engage these explorations, we'll be using SharePointBits' Northwind Trader sample database installed to a two-tier SharePoint Server 2010 Enterprise development environment on VMware Workstation. The database schema for the Northwind Trader database is shown below.
In this posting, we'll explore how to integrate web parts using query string methods. In this posting, we'll create two pages, a master page and a detail page, and then develop and configure these so that a user clicking on a hyperlink in the master page will be navigated to a detail page displaying additional data pertaining to the item clicked. We'll be exploring two approaches to accomplishing this objective: one using the XSLT List View web part and the other using the Data View web part.

Step 1: Add pages

Connect to the site. From the browser, create two new pages. For this posting, these will be named ProductMaster and ProductDetail. These can be wiki pages or web part pages.
Step 2: Build Product Detail Page

Launch SharePoint Designer 2010. Connect to the site, and then checkout and open the ProductDetail.aspx page for editing. Select the Insert ribbon, point to the Display Item Form button, click it, and then select the Products list.
A display form connected to the Products list will appear. Select the Options ribbon, and then point to the Add/Remove Columns button.
Click this button. The Add/Remove Columns dialog appears. Using this dialog, add, remove and arrange columns as desired.  For this posting, the columns and arrangement selected are shown below:
Some of these new fields will appear in their raw form. This can be fixed by reformatting. To do this, right-click anywhere on one of these fields, point to Format Item as, and then point to Label.
Click this option. Repeat this process for any other fields that display in their raw format. Once completed, the Data Display Form will appear more readable.
Select the Options ribbon, and then point to the Parameters button.
Click it. Then configure the parameters as shown below. Note that the query sting variable can have any name and that any default value can be used.
The data displayed in the Data Form will immediately update to show the default. Now click the Filter button on the Options tab. The Filter Criteria dialog appears. On this dialog, configure it as needed to associate the list item ID with the query string variable created previously.
Open a browser and navigate to the ProductDetail.aspx page. The default list item data is shown.
As a test, manually add the query string variable to the URL and set it to any value. The display form should update to the appropriate data.
In SharePoint Designer 2010, close the ProductDetail.aspx page, and check it back in.

Step 3: Build and Configure the Product Master page using the XSLT web part

The product listing can be developed in two ways: either using the XSLT List View web part or the Data View web part. The first approach will be explored next. Now, in SharePoint Designer 2010, checkout and then open ProductMaster.aspx.
Select the Insert ribbon, click on Data View, and then point to Products.
Click this item. This inserts an XSLT List View web part. To verify this is so, view the tab just above the web part. Thus, straightforwardly selecting and inserting a list from the Data View button in fact inserts and XSLT web part.
On the Options ribbon, click the Add/Remove Columns button. The Displayed Fields dialog appears. Configure this dialog as shown below.
The list view web part is immediately updated as shown below.
The approach here will be to format the Product Name as a query string hyperlink pointing to the ProductDetail.aspx page. At present, if you attempted to edit the XSL directly to format a column value as a query string hyperlink, you would not be able to find a convenient reference to the Product name field. To expose this field, select a value in the Product Name column, right-click it, point to Format Item as, then point to Hyperlink to, and then point to New Item Form, like so:
Click this selection. Choose the Split view to see both the WYSIWIG and code views simultaneously. The hyperlink and a field reference can now be seen:
Edit the highlighted XSLT as shown.
Save the file (but don't check it back in just yet). Then open a browser and point it to the ProductMaster.aspx page. Hover the cursor over any item in the Product Name column, while viewing the browser status bar. Note the URL query string value.
This concludes the XSLT list view approach. Next, we'll explore the Data View approach.

Step 4: Build and Configure the Product Master page using the Data View web part

In SharePoint Designer 2010, with the ProductMaster.aspx page still being edit, delete the XSLT web part. Then, from the Insert ribbon, click on the Data View button, and then point to Empty Data View.
Click this selection. And empty Data View web part is displayed on the page.
Click on the Data View where it states, Click here to select a data source. The Data Sources Picker appears.
Select the Products item, and then click OK. The Data Source Details task pane appears at right. Select the four fields as used previously, when inserting and configuring the XSLT list view web part: ID, Product Name, Supplier and Category.
Either drag and drop these fields onto the Data View or click the button above, Insert Selected Fields as... . As previously, some of the fields will not display user-readable text and you will need to reformat these as done previously.
Once completed, the list will appear similar to what was obtained previously using the XSLT approach.
Now, select the value displayed in the Product Name column. Then, on the Insert ribbon, click the Hyperlink button. The Insert Hyperlink dialog appears. In this dialog, navigate to the ProductDetail.aspx page, and then add the query string parameter as shown below:
Click OK, and then save the file (but don't check it back in just yet). Open a browser and navigate to the ProductMaster.aspx page. Be sure to login under the same account used to connect to the site through SharePoint Designer 2010 (or otherwise you will not be able to see the page modifications until after they are checked in). The list will be displayed. Hover the cursor over any hyperlink in the Product name column to see its URL.
Note the subtle differences between the XSLT List View web part display and the Data View web part display of the same list. Additional discussion on these differences is provided by Laura Rogers in SharePoint 2010 Data View and XSLT List View.

Summary

In this posting, we have explored how to integrate web parts using query string methods. We created a master page displaying a list of hyperlinks that connected to a details page displaying additional information associated with the item clicked. The three web parts explored were: XSLT List View, Data View and Data Form. We also explored how to modify the underlying XSL in order to create the query string hyperlinks. For additional information on the topics covered in this posting, see the references below.

In the next posting of this series, we'll explore adding another web part to the Product Detail page that also obtains its filter value from the same query string value.

References
Notes
  • Raymond Mitchell has written an excellent introduction to SharePoint 2007's Data View Web Part (DVWP).