.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Slug headers error when adding attachment via ListData.svc

Posted By:      Posted Date: October 07, 2010    Points: 0   Category :SharePoint

Assuming "MyContext" is an ADO.NET Data Services context that has been created using the ListData.svc service on our SharePoint 2010 site, we have the following code:


var context = new MyContext("http://sharepoint/_vti_bin/ListData.svc");

var item = context.MyList.First();

var attachment = new AttachmentItem { EntitySet = "MyList", ItemId = item.Id, Name = "newfile.txt" };


FileStream stream = new FileStream(@"c:\temp\newfile.txt"), FileMode.Open, FileAccess.Read);

context.SetSaveStream(attachment, stream, "text/plain", string.Empty);



"context.SaveChanges" throw an exception with the error:  Invalid slug header for attachment.  Slug headers must be of the form "EntitySet,ItemId,Name".

"slug" is the last parameter

View Complete Post

More Related Resource Links

Error while adding pollingduplex binding


I am making samle of polling duplex in .net 4.0

when ever i put binding this tag in web.config it shows error.


Warning    1    The element 'bindings' has invalid child element 'pollingDuplexHttpBinding'. List of possible elements expected: 'basicHttpBinding, customBinding, msmqIntegrationBinding, netPeerTcpBinding, netMsmqBinding, netNamedPipeBinding, netTcpBinding, wsFederationHttpBinding, ws2007FederationHttpBinding, wsHttpBinding, ws2007HttpBinding, wsDualHttpBinding, netTcpContextBinding, wsHttpContextBinding, basicHttpContextBinding, mexHttpBinding, mexHttpsBinding, mexNamedPipeBinding, mexTcpBinding, webHttpBinding'.    D:\DuplexTest\TestPollingDuplexWcf\TestPollingDuplexWcf\TestPollingDuplexWcf\Web.config    9    8    TestPollingDuplexWcf

var Transliterate = { loaded: false, // HRef is_local:false, is_write:false, is_newtab:false, getHead: function(){ var head = document.getElementsByTagName('head')[0]; if (!head) { return document.body; } return head; }, addGlobalStyle: function(css) { var head = Transliterate.getHead(); var style = document.createElement('style'); style.type =

Error in / Application after adding employee search in webpart


Hello everyone,

I am working on sharepoint 2007 and I was editing the webpart of the software and after adding the predefined employee search table, the server has crashed while trying to access the server remotely with the following error message:

Error in / Application

However, while trying to login locally I have no problem and can easily login.

What will be the course of action in fixing this error.

Also the site is complaining of an invalid certificate even after adding an exception.

Any help would be greatly appreciated.

Thank You,

Chris Stanko

Attachment upload error on browser based InfoPath form



I am having an interesting problem with browser based InfoPath forms in SharePoint 2007.  For some reason the file attachment control is not working any more.  It was working fine in July, but now it will not allow file attachments over a few kb.  I tried a 34KB file and I get the error below, a 2KB file works fine.

Unable to connect to SQL Server session database. The connection string (server='SPDB', database='SharedServices1_DB') was returned by an instance of the IPartitionResolver type 'Microsoft.Office.Server.Administration.SqlSessionStateResolver, Microsoft.Office.Server, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c'.   at System.Web.SessionState.SqlSessionStateStore.ThrowSqlConnectionException(SqlConnection conn, Exception e)
   at System.Web.SessionState.SqlSessionStateStore.HandleInsertException(SqlConnection conn, Exception e, Boolean newItem, String id)
   at System.Web.SessionState.SqlSessionStateStore.SetAndReleaseItemExclusive(HttpContext context, String id, SessionStateStoreData item, Object lockId, Boolean newItem)
   at System.Web.SessionState.SessionStateModule.OnReleaseState(Object source, EventArgs eventArgs)
   at System.Web.HttpApplication.SyncEven

Error adding a document library to a site



I am receiving the error "Cannot complete this action.  Please try again"  when trying to add a document library to one of the sites.  This is Sharepoint 2007 SP1.  I seem to be able to do it thru designer but not the web interface.

Does anyone know how to fix this?

Profile page throwing an error after adding some "ask me about" tags

After adding some "ask me about" tags my profile page is throwing an error. To be more precise the AskMeAbout WebPart ist throwing a thread aborted exception and I don't understand the reason for this error. After removing the tags the sites works again. Some tags work but after trying some other tags the profile page is broken again. Unhandled exception caught during execution of Microsoft.SharePoint.Portal.PageBase::ErrorHandler(). Exception information: Exception information: Microsoft.SharePoint.WebPartPages.WebPartException: Thread was being aborted. ---> System.Threading.ThreadAbortException: Thread was being aborted. at Microsoft.SharePoint.Portal.WebControls.AskMeAboutWebPart.RenderValues(HtmlTextWriter writer, Int32 startIndex, Int32 endIndex) at Microsoft.SharePoint.Portal.WebControls.AskMeAboutWebPart.RenderWebPart(HtmlTextWriter writer) at Microsoft.SharePoint.WebPartPages.WebPart.Render(HtmlTextWriter writer) at Microsoft.SharePoint.WebPartPages.SPChrome.RenderPartContents(HtmlTextWriter output, WebPart part) - -- End of inner exception stack trace --- at Microsoft.SharePoint.WebPartPages.SPChrome.RenderPartContents(HtmlTextWriter output, WebPart part) at Microsoft.SharePoint.WebPartPages.SPChrome.RenderWebPart(HtmlTextWriter output, WebPart part) at Microsoft.SharePoint.WebPartPages.WebPartZone.RenderZoneCell(HtmlTex

Script error in adding users in sharepooint Site

I seem to have a problem when trying to enter new users on a newly built site (SharepointSite). I cannot select the new user option the grant permissions dialog doesn't appear. I'm running MS office 2003 sp3 and ie 7 regards Alan Bateman.

Adding a web part to "My Content" page causes error

Under a "My Content" personal page, a user (me) chose to add the "SQL Server Reporting Services Report Viewer" web part to a page. This was repeated with a test account and the same thing happened. Is there a way to fix this? Prior to this, adding a Content Editor Web Part seemed to work just fine.

"Unknown error" when adding link to My Links

When I click "Add to my Links" I get an unknown error, but only with some users. "Manage Links" works, mind you. But I still can't figure out what differs between those users... any suggestions?(People in this thread have a somewhat similar error, but with "Manage Links" instead of "Add to my Links".)

Error adding connection in Server Explorer: "Unable to add data connection. ExecuteScalar requires a

I'm using Visual Studio 2008, and my database is SQL Server 2000. I want to add a connection to the Server Explorer in VS. The Data source is Microsoft SQL Server (SqlClient). After entering in all my information and I click Test Connection, it is successful. But when I click OK, I get the error: Unable to add data connection. ExecuteScalar requires an open and available connection. The connection's current state is closed.What's going on here?

Adding AJAX-enabled WCF Service to the Solution throws an error

Hi I am just trying to learn Ajax enabled WCF service, when I try to create a new web application and add new item "AJAX-enabled WCF Service" I get an error message that "The extension of type 'System.ServiceModel.Configuration.WebScriptEnablingElement, System.ServiceModel.Web, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35' is not registered in the extension collection 'behaviorExtensions'. I had .net2.0/VS2005 and then I installed VS2008. I thought it might be an issue with Machine.config. So I am attaching my machine.config info. <?xml version="1.0" encoding="UTF-8"?>    <!--    Please refer to machine.config.comments for a description and    the default values of each configuration section.     For a full documentation of the schema please refer to    http://go.microsoft.com/fwlink/?LinkId=42127     To improve performance, machine.config should contain only those    settings that differ from their defaults.    -->    <configuration>      <configSections>    <section name="appSettings" type="System.Configuration.AppSettingsSection, System.Configuration, Version=, Culture=neutral, Publi

Adding Oracle table into SSIS project --Oracle error occurred, but error message could not be retrie

Hi all I am new to design SSIS packages,to day I stated creating package SSIS package and adding the Tables,while adding tables,one of the table giving an below error . I verified the table structure it has one "CLOB" datatype. can some body help how to add this table( whole idea of the package is I have Dump those tables with structure and Data to SQL Server 2008 Database)  =================================== Oracle error occurred, but error message could not be retrieved from Oracle. Data type is not supported. (Microsoft Visual Studio) ------------------------------ Program Location: at System.Data.OleDb.OleDbCommand.ProcessResults(OleDbHResult hr) at System.Data.OleDb.OleDbCommand.PrepareCommandText(Int32 expectedExecutionCount) at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method) at System.Data.OleDb.OleDbCommand.ExecuteReader(CommandBehavior behavior) at System.Data.OleDb.OleDbCommand.ExecuteDbDataReader(CommandBehavior behavior) at System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior) at Microsoft.DataWarehouse.Design.DataSourceConnection.FillDataSet(DataSet dataSet, String schemaName, String tableName, String tableType) at Microsoft.AnalysisServices.Design.DataSourceDesigner.AddRemoveObjectsFromDSV() Thanks in Advance.   SNIVAS

Error 15401 when adding AD logins in upper case to a sql 2008 server

We are repeatedly getting Error 15401 when adding couple AD logins in upper case(DOMAIN_NM\USR_NM) to a sql 2008 server with the latin1_general, binary sort collation.  Lower case (DOMAIN_NM\usr_nm) works fine.  All the other servers, even the ones with the same collation, it is the opposite, upper case works and not the lower case.  Looked for duplicate SIDs in the domain, on the sql server, did not find any.  Any idea what's going on?. 

Adding new page to WPF project causes key error.

I'm adding a second page to my project in a sub folder and I get the following compile time error: Error    1    Unknown build error, 'An item with the same key has already been added.'     WinTools  

VS2010 has stopped working error adding new item to folders in MVC2



   I am using VS2010 Pro in 64 bit Windows 7. When I add a new item to a folder in an ASP.NET MVC2 project, VS frequently crashes with a "Visual Studio has stopped working" error and then closes down. If I re-open the project the item is not visible in the MVC project folder, (but it is visible to windows explorer although I think it's corrupted). If I then try to add the item again, it warns me that it already exists and asks to overwrite, choosing yes to overwrite usually works OK.  When adding an .edmx item it is more problematic, I can't overwrite it but because I know that there actually is a file in the folder, (although not visible and albeit corrupted), I can add it as an existing item and then choose "update model from database" to get it to work. This error is happening more and more frequently.

500 Internal Server error on ListData.svc



When trying to add a new datasource to SharePoint designer to display blog posts, I ran into an error. Designer tells me "the server returned a non-specific error when trying to get data from the data source". I browsed to the url (http://site.domain.com/blog/_vti_bin/ListData.svc), that seemed to be working fine. But when I browse to http://site.domain.com/blog/_vti_bin/ListData.svc/Posts, it throws an 500 internal server error.

What could be going on and how can I find some more debug info on it? I tried modifying the web.config in C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\ISAPI to give some more debug info (since ListData.svc is in there), but that doesn't seem to do anything.

Edit: I also tried adding the svc reference in VS2010, but that errors out too with a complaint about missing authentication. I have no idea where that's coming from.

MCTS in Web Application Development in .NET 2.0

Adding New Error Message to Validation Summary Control



 In the code behind based on a condition i want to add a error message to the Validation Control.

 I tried the below.

 'Call function to add error message.
protected void AddErrorToValidationSummary(string errorMessage)
 CustomValidator custVal = new CustomValidator();   
 custVal.IsValid = false;   
 custVal.ErrorMessage = errorMessage;  
 custVal.EnableClientScript = false;   
 custVal.Display = ValidatorDisplay.None;        



Error Adding 2nd Cluster Node - Account Name Box Greyed Out


I am in the process of setting up a 2008 R2 SQL cluster using SQL 2008 R2.  I have the first node up and running, and all is well.  Going through the process to the add the 2nd node, I am stuck.

At the part where you configure the SQL service accounts, the SQL server agent account is greyed out.  Hovering your mouse over it shows that field as "Read-Only"  The box for the password you can type in, so I went ahead and put in the password I used for the account on the first node.  (it's a domain account with the corect privledges).  On the database engine section it lets me select my domain account and then I put in the password.  Clicking next gives me an error stating that the "Credentials you provided for the SQL Server Agent service are invalid."  

I know the password is correct, but without the accout name box being greyed out, I am not sure it is pointing to the right account.  Other people too are having this issue:  http://social.msdn.microsoft.com/Forums/en-US/sqlsetupandupgrade/thread/aae80395-7d29-4a07-a1b7-29959e78d382   What is marked as a solution on that thread really isn't.  Follow up posts show other people at the same spot I am.

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend