You must be wondering what is new in this. We can certainly change the name or the title of the document inside document library from code.
Well, no. we cannot do that right away as Name and Title of SPFile are read only fields. As each document is SPFile inside document library we might think that changing name and title field would do the job. But it’s not. Check the below images. Properties are read only.
So what can be done? Well as we all know that each document inside document library is not only SPFile but also SPListItem.
Now these are my shared documents and check the document name.
And let’s re write our code in this way.
And when you execute
I hope this will help.