DELETEATTACHMENT

Used to delete an attachment from a list item.

Syntax

DELETEATTACHMENT(string listName, int itemId, string fileName);

Example: to delete attachment file named helloworld.txt from list item 3 in list Files:

CALL DELETEATTACHMENT('Files', 3, 'helloworld.txt');

Code examples

Delete attachment

var connectionString = @"Server=mysharepointserver.com;User=spuser;Password=******;Database=sitename;Authentication=Ntlm;";
using (var connection = new SharePointConnection(connectionString))
{
    connection.Open();
    using (var command = new SharePointCommand(@"CALL DELETEATTACHMENT('Files', 3, 'helloworld.txt')", connection))
    {
        command.ExecuteNonQuery();
        Console.WriteLine("Last affected: " + command.LastRecordsAffected);
    }
}

Code result

Last affected: 1


Skip Navigation Links.

Visa     MasterCard