hmcgeehan
asked on
Sharepoint 2007 - Document Property not saving if the column name is 'Title'
Hi
I have a rather bizarre error in Sharepoint 2007.
I have a web part where I upload a document to a Document Library..
I allow the user to enter in the properties of the document and it all saves up to the Document Library fine.
All the properties get saved except for 'Title'
So the problem is here ....
docProperties["Publication Title"] = tbTitle.Text;
docProperties["Title"] = tbTitle.Text;
When I look at the documents in the document library it will have a value for 'Publication Title' but not for 'Publication'
I have checked the 'internal names' of the columns by sorting the document library by the relevant column ...
So if for example I click on the 'Circulation' column I can see this in the URL ...
...Documents/Forms/AllItem s.aspx?Sor tField=Cir culation&S ortDir=Asc ...
And if I click on the 'Title' column I can see this in the URL ...
...Documents/Forms/AllItem s.aspx?Sor tField=Tit le&SortDir =Asc...
So it seems I have the correct name for the column 'Title'
Any ideas why it's not saving this one property?
I have a rather bizarre error in Sharepoint 2007.
I have a web part where I upload a document to a Document Library..
I allow the user to enter in the properties of the document and it all saves up to the Document Library fine.
All the properties get saved except for 'Title'
So the problem is here ....
docProperties["Publication
docProperties["Title"] = tbTitle.Text;
When I look at the documents in the document library it will have a value for 'Publication Title' but not for 'Publication'
I have checked the 'internal names' of the columns by sorting the document library by the relevant column ...
So if for example I click on the 'Circulation' column I can see this in the URL ...
...Documents/Forms/AllItem
And if I click on the 'Title' column I can see this in the URL ...
...Documents/Forms/AllItem
So it seems I have the correct name for the column 'Title'
Any ideas why it's not saving this one property?
using (SPSite oSite = new SPSite(sharePointSite))
{
using (SPWeb oWeb = oSite.OpenWeb())
{
if (System.IO.File.Exists(PDFFileWaitingPath))
{
SPFolder myLibrary = oWeb.Folders[documentLibraryName];
if (myLibrary.UniqueId == null)
{
}
// Prepare to upload
Boolean replaceExistingFiles = true;
String fileName = System.IO.Path.GetFileName(PDFFileWaitingPath);
FileStream fileStream = File.OpenRead(PDFFileWaitingPath);
Hashtable docProperties = new Hashtable();
docProperties["Publication Title"] = tbTitle.Text;
docProperties["Title"] = tbTitle.Text;
docProperties["Category"] = ddlCategory.SelectedIndex + 1;
docProperties["Circulation"] = tbCirculation.Text;
docProperties["Page"] = tbPage.Text;
docProperties["Publication"] = ddlPublication.SelectedIndex + 1;
docProperties["Publication Author"] = tbAuthor.Text;
docProperties["Publication Date"] = dtcPublicationDate.SelectedDate;
docProperties["Posted Date"] = DateTime.Now;
docProperties["Summary"] = tbSummary.Text;
docProperties["Rank"] = tbRank.Text;
// Upload document
SPFile spfile = myLibrary.Files.Add(fileName, fileStream, docProperties, replaceExistingFiles);
// Commit
myLibrary.Update();
fileStream.Close();
// To move a file or folder to a new location:
System.IO.File.Move(PDFFileWaitingPath, PDFFilePublishedPath);
System.IO.File.Move(XMLFileWaitingPath, XMLFilePublishedPath);
}
else
{
throw new FileNotFoundException("File not found.", PDFFileWaitingPath);
}
}
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
And all the other properties with a space in them save fine too ...
docProperties["Publication Author"] = tbAuthor.Text;
docProperties["Publication Date"] = dtcPublicationDate.Selecte dDate;
docProperties["Posted Date"] = DateTime.Now;
The problem is that this one ...
docProperties["Title"] = tbTitle.Text;
Doesn't save (even if there is a value for tbTitle.Text
thanks
docProperties["Publication
docProperties["Publication
docProperties["Posted Date"] = DateTime.Now;
The problem is that this one ...
docProperties["Title"] = tbTitle.Text;
Doesn't save (even if there is a value for tbTitle.Text
thanks
ASKER
But it DOES save the property for 'Publication Title'
It DOESNT save the property for 'Publication'
Thanks