.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

How do you rename a document in Batch Update?

Posted By:      Posted Date: September 07, 2010    Points: 0   Category :SharePoint
Hi, I have tried to rename a file as so. xml += "<Method ID='" + currentID + "' Cmd='Update'>"; xml += "<Field Name='ID'>" + ID + "</Field>"; xml += "<Field Name='FileRef'>" + fileRef + "</Field>";   xml += "<Field Name='LinkFilename'>" + "Accommodation.pdf" + "</Field>"; </Method> I have tried Name instead of LinkFilename and still no joy. Can anyone help. Thanks. John.

View Complete Post

More Related Resource Links

SharePoint Batch Update Auto Increment Field Value


Hello All,

I am making use of SharePoint List Batch Updating methodology in order to update the items in bulk. I build the query dynamically for each and every item using StringBuilder and process the data ultimately using 'ProcessBatchData' Method.

Now, I have a requirement where I have to increment a particular field value in the query while iterating through each item for building the query. How can I auto-increment a field value for each item in the batch query?


Rename a document in Doc Library without changing the modified by

How do I rename the document in the document library without changing the modifed by and no increment of version? My Document Library setting is Major Version and CheckOut is set to No. I'm using SPSecurity.RunWithElevatedPrivileges to rename the document I had tested to checkout then checkin but there is an increment in version. Here is a sample code that will rename the filename but the modified by changed to System Account. SPSecurity.RunWithElevatedPrivileges(new SPSecurity.CodeToRunElevated(delegate() { using (SPSite elevatedSite = new SPSite(SPContext.Current.Site.ID)) { using (SPWeb elevatedWeb = elevatedSite.OpenWeb(SPContext.Current.Site.RootWeb.ID)) { elevatedWeb.AllowUnsafeUpdates = true; SPList list = elevatedWeb.Lists["Library1"]; SPListItem item = list.GetItemById(documentID); if (updateFilename) item["Name"] = filename; item.SystemUpdate(); } } })); Is there anyone out there who can help? Thanks in advanced.

How to rename the document using event receiver during upload

Hi all, I am going to programmaticlly rename the document when it is being uploaded to the document library. In Visual Studio 2010, I used the event receiver and choosed the documment libray type, for the event I selected 'ItemAdding". However I am not able to update the file name using the codes inside this thread: http://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/thread/5c3dcc5d-3113-463d-8835-2a050b2471a6/ Can anyone help me with this problem? Thanks!

event receiver to update created field of uploaded document

Hi,   I need to update the created column with the document creation time . 1) First should i use ItemAdding event or Item Added event 2) how do i get the file created properties and assign it to the cdocument library created column.

Multiline text field in document library and item update from Word trouble

Hi I have faced a bit of odd problem. Here is the scenario: I have document library with text columns (multiple lines of text) that are set to unlimited length. I have a workflow that runs with Word documents (.docx) that stores information in XML to this field. Everything works perfectly until document is edited in Word and saved back to document library. After Word saves my document in document library, the multiline text field is "cutted", only 7 rows of text is saved to my field. I have tried hiding my text field, making it sealed or readonly, but still Word breaks my field. Funniest thing is that when editing document in Word, this field should not have any changes (meaning that I dont show my "long text field" in document information panel back in Word). I have tried also creating event handler to handle itemupdating event in document library where I switch spweb.parserenabled property to false and in itemupdated event I switch it back on. Also I have tried to remove all line changes from XML with no luck. This XML saving to long text field works perfectly with many other places but in this one environment this does not seem to work :( I am looking forward to any suggestions what to try next. I have been wondering about using the eventhandlers and trying to "protect" my text field with some logic but that is still just a thought.   T

Excel fields linked to files in the document library do not update


We are having an issue with an Excel spreadsheet that is linked to several Excel documents in a document library.  Mutliple staff members update several "sub" spreadsheets with information that is rolled up to the "master" spreadsheet.  Excel appears to behave correctly in that if I open both the sub and master spreadsheets in my Excel window at the same time, the data in master gets updated.  If I just open the master, I have stale data.  I'm not sure SharePoint is to blame here, so I'll post this in the Excel forums as well, but any information or experience anyone has had with this would be fantastic.

Thanks in advance for any help/advice!

Can we Replace/Update/Overwrite uploaded document for an item in SP DocumentLibrary?


Hi all, I have a SP Document library item which is holding a document of type .Doc, now i want to Replace/Update/Overwrite the same SP DocumentLibrary's item with other type ex. .Pdf through Sharepoint ObjectModel. Can it be possible. If so can u share ur thoughts/code.

Best Regards, Srikanth Ch

MOSS 2007 : how to update document uploader username ?

Hi everyone, I have a MOSS 2007 farm (1 single server including all MOSS roles and SQL) into Active Directory.

I've be recently asked to update (synchronize) all MOSS usernames with AD after changing names of user into AD. It worked (central admin -> Shared services -> user profiles)

The problem is that some old documents were uploaded to MOSS doc librairies and the username of the uploader did not sync.

Is anyone know that problem and the solution ?

Thank you for helping.

MOSS 2007 : how to update document uploader username ?

Hi everyone, I have a MOSS 2007 farm (1 single server including all MOSS roles and SQL) into Active Directory.

I've be recently asked to update (synchronize) all MOSS usernames with AD after changing names of user into AD. It worked (central admin -> Shared services -> user profiles)

The problem is that some old documents were uploaded to MOSS doc librairies and the username of the uploader did not sync.

Is anyone know that problem and the solution ?

Thank you for helping.

Unable to update the information in the Microsoft Office Document libraryname/documentname.xls

Hi, one of our users is facing this particular issue, he is able to upload excel files to other libraries/sites
he has Office 2007 installed, IE7, Windows XP,
the document is saved in 2003 version, he is able to upload same document on other libraries,
but whenever he tries to upload to this particular library he gets the following exception

Server Error in '/' Application

description: an unhandled exception ocurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

exception details: System.Runtime.InteropServices.COMExcetion: Unable to update the information in the Microsoft Office document LibraryName/documentname.xls

Stack Trace
[COMException (0x81071003): Unable to update the information in the Microsoft Office document LibraryName/documentname.xls]
Microsoft.SharePoint.Library.SPRequestInternalClass.AddOrUpdateItem(String bstrUrl, String bstrListName, Boolean bAdd, Boolean bSystemUpdate, Boolean bPreserveItemVersion, Boolean bUpdateNoVersion, Int32& plID, String& pbstrGuid, Guid pbstrNewDocId, Boolean bHasNewDocId, String bstrVersion, Object& pvarAttachmentNames, Object& pvarAttachmentContents, Object& pvarProperties, Boolean bCheckOut, Boolean bCheckin, Boolean bMigration, Boolean bPublish) +0


Item Update, Document Status.


Hi all

i am debugging item update event of a file.

It got fired when i upload a document in the document Library or i change some properties of a document.

i want to add some custom logic in this item update event and that logic depends upon the file status, if document is uploaded then some piece of code runs and if document is updated then some different piece if code runs.


How can i get that the file is updated or uploaded?

Rename file having special characters when uploading to document library



i am trying to use the ItemAdding event handler to capture the filename and rename it when uploading. But it doesn't work.

Does anyone have any idea which event should i consider OR is there any other solution??


update document file using spd workflow

hi, I managed to create  a workflow to copy list item from document library 1 to document library 2. then, I configure the workflow to update the document properties and the file, the document properties( columns ) get updated but not the file ( as in if I change the contents of a word file ), how do I get this to be reflected in the other library.

How to update metada of the document which started the workflow.



I have created a workflow on SharePoint 2007 with Visual Studio 2008.


Basically the workflow will start when we add a document in the document library.

While the workflow is running, I would like to get the id or url of the document which started the workflow.

How can i achieve this programmatically ?




Document Set Shared Columns won't update


I want a document set where each content type in this set will have a common set of properties.  I want it so when any property in a document is changed, or a property in the set changes that everything gets updated.  So a change in to any one column will change everything.


I tried setting this up, but it did not work.  If I edit a property on the doc set, it will cascade down to the children, but it won't work the other way around.

How to update a document field using Taxonomy term programatically



I have created a custom column name "Region" (Managed Metada type and associated with Term - Region which has following terms: NA, EU, Asia, Africa)

The column Region is associated with two custom type: Folder custom type and Document Custom Type.

When a folder is created, the user select the Region filed using Manage Metadata.

When a document is created/imported/updated in the folder we need to update the region field automatically based on the folder data.

I am planning to create Event Receiver to handle such request.  how to get the value from folder type for Region field and populate the same value to the document type. 




Update document using claims based service


We have a document in a doc lib we need to update a field on the document.  We are using a claims based environment over the internet through ssl.  What is the best way to do this?  A rest service post?  Client side linq to sharepoint?  Any ideas/blogs/walkthoughs would be most helpful.


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