Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 25064

Sharepoint 2013 Community site: Unable to reply on a post

$
0
0

Im working on Sharepoint 2013 Community site template. When I manually create a discussion in discussions list liking and replying features are working fine, but when I programmatically add a dicussion in discussions list its giving the following error "Value does not fall within the expected range".

This is the C# code im using to add an item in discussions list.

using (SPSite site = new SPSite("http://site-url"))
{
    using (SPWeb web = site.OpenWeb())
    {
        SPList list = web.Lists["Discussions List"];
        SPListItemCollection listItemCln = list.GetItems(list.Views["Management"]);

        SPListItem item = list.Items.Add();
        item["Title"] = "New Post";
        item["Body"] = "Body of the post";
        item.Update();
    }
}

I checked the log files of sharepoint also it gave the follwing error

Failed to cache field with id "{69062c99-d89f-4162-bbc5-b1acf8bfe123}", overwrite=0

SocialRESTExceptionProcessingHandler.DoServerExceptionProcessing - SharePoint Server Exception [System.ArgumentException: Value does not fall within the expected range.    
 at Microsoft.SharePoint.Utilities.SPUtility.CreateNewDiscussionReply(SPListItem parent)    
 at Microsoft.SharePoint.ServerStub.Utilities.SPUtilityServerStub.InvokeStaticMethod(String methodName, XmlNodeList xmlargs, ProxyContext proxyContext, Boolean& isVoid)    
 at Microsoft.SharePoint.Client.ServerStub.InvokeStaticMethodWithMonitoredScope(String methodName, XmlNodeList args, ProxyContext proxyContext, Boolean& isVoid)]

Can anyone help me on this please


Viewing all articles
Browse latest Browse all 25064

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>