Wednesday, October 12, 2011

Opening an Infopath form library template from Infopath in a link

I've found a lot of bad info on how to do this and it's not well documented so hopefully this helps someone:

first create a JavaScript function so that your links aren't super long:


<script type="text/javascript">
            function OpenForm(absSiteUrl, siteRelFormUrl, siteRelSaveUrl)
            {
                        var formUrl = absSiteUrl + siteRelFormUrl;
                        var saveUrl = absSiteUrl + siteRelSaveUrl;
                        var formSvcUrl = absSiteUrl + "_layouts/FormServer.aspx?XsnLocation=" + formUrl;
                        CoreInvoke('createNewDocumentWithRedirect2',event, formUrl, saveUrl, 'SharePoint.OpenXmlDocuments.2', true, formSvcUrl, false, 0);
            }
  </script>

then create a link like so:

<a href="javascript:OpenForm('[AbsoluteSiteUrl]','[SiteRelativeFormUrl]','[SiteRelativeSaveLocationUrl]')">open form</a>

here are examples for the vars
[AbsoluteSiteUrl] = http://mysp2010server/siteA/
[SiteRelativeFormUrl] = myformlibrary/Forms/template.xsn
[SiteRelativeSaveLocationUrl] = myformlibrary

Tuesday, October 11, 2011

People Search from MySite returns 404

If you have MySites and a Search Center running in your farm, you may have overlooked a not-so-obvious configuration setting. When setting up MySites for a User Profile service application, your Search Center URL must point to the "Pages" folder where the Search Center publishing pages are located instead of the Search Center web URL. Otherwise, a People Search from a MySite will forward the request to to

http://[searchcenter]/PeopleResults.aspx?k=searchquery


(which doesn't exist) instead of

http://[searchcenter]/PeopleResults.aspx?k=searchquery

which is where the PeopleResults.aspx page is actually located.


TLDR: Use http://[searchcenter]/Pages/ for your Search Center url in UPA MySite Settings.