InfoPath Publishing error – The following url is not valid

I was involved in a SharePoint 2013 On-Premise Platform setup. After our successful installation we faced an issue as stated below.

Issue:

We were not able to publish any InfoPath form to  SharePoint site created in the 2013 environment, in spite of the site being accessible from the browser. When we try to publish the form we get the following error “The following url is not valid”. This is a quite common and annoying error message that you get when it comes to InfoPath publishing.

clip_image001

We got a HTTP 404 error when we analyzed the fiddler trace, while the InfoPath form is published to SharePoint.

clip_image002

Options attempted for Fix

After referring so many blogs, I patiently tried the following steps to fix this problem. But nothing worked.

• Checked if it has a root site collection. (Make sure the SharePoint application that contains the site you are publishing to, has a site in the root)

• Stopped the “System Event Notification” service

• Added the verb entry in the http Handler tag (Make sure that the <remove verb=”*” path=”*.asmx”/> is just under <httpHandlers> tag)

• Added a host entry for the URL and restarted the server

• Delete all sub keys of “Server Cache” key, they are in form of _http://xxxxxxx

• This seems to be the problem when your site is on a non-default port, Switched to port 80, still same error.

Resolution:

Upon troubleshooting this issue i found that InfoPath client was not able to find the root (/) site collection and it threw a HTTP 404 error in Fiddler.  We had to add the HTTP verbs (GET, POST, PUT, HEAD, etc.) explicitly in our IIS Server -> request filtering module which solved the particular issue that I was facing

After adding the verbs, verify the new verbs are in config file C:WindowsSystem32inetsrvconfigapplicationHost.config.

Verbs will be under /configuration/system.webServer/security/request Filtering/verbs section.

In a nutshell the PUT request to the site was failing, for which i had to add the verbs.

 Subscribe to my blog

How to publish a post to the Office 365 SharePoint 2013 Social Feed using Client Object Model (CSOM)

In this article, I’ll explain on how to post to Office 365 SharePoint Social Feed using .NET Client Object Model (CSOM).

Step1  Create a Console application by name ‘PublishToSocialFeed’

Step2 Add references to the following assemblies

Microsoft.SharePoint.Client
Microsoft.SharePoint.ClientRuntime
Microsoft.SharePoint.Client.UserProfiles

Step3 Add references to the following assemblies

using Microsoft.SharePoint.Client;
using Microsoft.SharePoint.Client.Social
;

Step4

Create a Public Function by name ‘PublishPost’ and add the following snippet of code.

public static void PublishPost()
       {
           Uri oUri = new Uri(“
https://yoursite.sharepoint.com”);

           Office365ClaimsHelper claimsHelper = new Office365ClaimsHelper(oUri, “youruserid@yoursite.onmicrosoft.com”, “yourpassword”);
          
           using (ClientContext oClientContext = new ClientContext(oUri))
           {
               oClientContext.ExecutingWebRequest += claimsHelper.clientContext_ExecutingWebRequest;

               SocialFeedManager oSocialFeedManager = new SocialFeedManager(oClientContext);
              
               //Create an instance of Social Data Item object
               SocialDataItem oSocialDataItem = new SocialDataItem();
               oSocialDataItem.ItemType = SocialDataItemType.Link;
               oSocialDataItem.Text = “Google”;
               oSocialDataItem.Uri = “
http://google.com”;

               //Create an instance of Social Post Creation Data
               SocialPostCreationData oSocialPostCreationData = new SocialPostCreationData();
               oSocialPostCreationData.ContentText = “This is my first post”;

               oSocialFeedManager.CreatePost(null, oSocialPostCreationData);
               oClientContext.ExecuteQuery();

               Console.WriteLine(“Published a news feed”);
           }

       }
To know more about ‘Office 365 Helper’ class and active authentication for Office 365, please refer to Wictor Wilen’s article.

 Subscribe to my blog

How to retrieve list of installed Workflows in SharePoint 2013 Office 365 site using CSOM

In this article, I’d be articulating on how to retrieve list of installed workflows in SharePoint 2013 Office 365 site using Client Side Object Model (CSOM). Just to give a background the workflow framework in SP 2013 has undergone a major revamp, there are new WorkflowServicesManager and WorkflowDeploymentService objects, we’d also be leveraging the new APIs accordingly to retrieve

Create a console application and name it as ‘RetrieveInstalledWorkflows’.

Add references to the following dll’s.

Microsoft.SharePoint.Client.dll
Microsoft.SharePoint.Client.Runtime.dll
Microsoft.SharePoint.Client.WorkflowServices.dll

Import the following namespaces

using Microsoft.SharePoint.Client;
using Microsoft.SharePoint.WorkflowServices;
using Microsoft.SharePoint.Client.WorkflowServices;
using Microsoft.SharePoint.Client.Workflow;

Create a static method by name ‘RetrieveInstalledWorkflows’ and implement the following snippet of code.

public static void RetrieveInstalledWorkflows()
{
    Uri oUri = new Uri(“
https://yoursite.sharepoint.com”);
   
  
    Office365ClaimsHelper claimsHelper = new Office365ClaimsHelper(oUri, “userid@yoursiter.onmicrosoft.com”, “your password”);
    using (ClientContext oClientContext = new ClientContext(oUri))
    {      

        oClientContext.ExecutingWebRequest += claimsHelper.clientContext_ExecutingWebRequest;
       
        //Get the instance of Workflow Services Manager
        WorkflowServicesManager oWorkflowServicesManager = new WorkflowServicesManager(oClientContext,oClientContext.Web);

        //Hook to WorkflowDeploymentService
        WorkflowDeploymentService oWorkflowDeploymentService = oWorkflowServicesManager.GetWorkflowDeploymentService();

        //Fetch all the installed workflows
        var oWorkflowDefinitionCollection = oWorkflowDeploymentService.EnumerateDefinitions(true);
        oClientContext.Load(oWorkflowDefinitionCollection);

 
        oClientContext.ExecuteQuery();

        foreach(var oWorkflowDefinition in oWorkflowDefinitionCollection)
        {
            Console.WriteLine(“Workflow”+oWorkflowDefinition.DisplayName);
        }

        Console.ReadLine();

    }

}

To know more about Office365ClaimsHelper class, please refer to Wictor Wilen’s article on active authentication

.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, “Courier New”, courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }

 Subscribe to my blog

How to publish a post to SharePoint Social Feed using SharePoint 2013 JSOM

In this article, I’ll explain how to publish a Post to the SharePoint Social Feed using SharePoint 2013 JavaScript Object Model (JSOM).Open Visual Studio 2013, Create a new SharePoint Hosted App and name it as PublishPost.

Go to default.aspx, add a reference to SP.UserProfiles.js in the PlaceHolderAdditionalPageHead

.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, “Courier New”, courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }

/_layouts/15/sp.userprofiles.js

Add the following Javascript function in the App.JS file (comment out the existing code already in the file)

.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, “Courier New”, courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }

SP.SOD.executeOrDelayUntilScriptLoaded(WritePost, ‘SP.UserProfiles.js’);

function WritePost() {
    var oclientContext;
    var ofeedManager;
    var oresultThread;

    // Initialize the current client context and the SocialFeedManager instance.
    oclientContext = SP.ClientContext.get_current();
    ofeedManager = new SP.Social.SocialFeedManager(oclientContext);

    // Add a link to be included in the post.
    var olinkDataItem = new SP.Social.SocialDataItem();
    olinkDataItem.set_itemType(SP.Social.SocialDataItemType.link);
    olinkDataItem.set_text(‘My blog url’);
    olinkDataItem.set_uri(‘
http://sundarnarasiman.net’);
    var osocialDataItems = [ olinkDataItem ];

    // Set up the post content
    var opostCreationData = new SP.Social.SocialPostCreationData();
    opostCreationData.set_contentText(‘The text for the post, which contains a {0}.’);
    opostCreationData.set_contentItems(osocialDataItems);

    // Write the post
    oresultThread = ofeedManager.createPost(null, opostCreationData);
    oclientContext.executeQueryAsync(WriteSucceeded, WriteFailed);
}

function WriteSucceeded(sender, args) {
    $get(“ResultMessage”).innerText = ‘Successfully posted the message to Posts’;
}
function WriteFailed(sender, args) {
    $get(“ResultMessage”).innerText = ‘Failure in writing message’ + args.get_message();
}

Open the default.aspx and add the following snippet

<Div id=”ResultMessage” style=”color: blue”></Div>

Open the AppManifest.XML and provide FullControl permission to UserProfiles (Social) and Tenant. Otherwise, you’ll get a permission error.

<App xmlns=”http://schemas.microsoft.com/sharepoint/2012/app/manifest”
     Name=”PublishPost”
     ProductID=”{72faf665-bf93-4a8e-88a7-2d2ad0be0f9d}”
     Version=”1.0.0.0″
     SharePointMinVersion=”15.0.0.0″
>
  <Properties>
    <Title>PublishPost</Title>
    <StartPage>~appWebUrl/Pages/Default.aspx?{StandardTokens}</StartPage>
  </Properties>

  <AppPrincipal>
    <Internal />
  </AppPrincipal>
  <AppPermissionRequests>
    <AppPermissionRequest Scope=”
http://sharepoint/social/tenant” Right=”FullControl” />
    <AppPermissionRequest Scope=”
http://sharepoint/content/tenant” Right=”FullControl” />
  </AppPermissionRequests>
</App>

.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, “Courier New”, courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }

Now, you’ll see that the post being published to MySite.

social post

 Subscribe to my blog