I am gettign following error value does not fall within expected range
when i try to move file to one doc lib to another doc lib along with
some metada.
error is occured at file.Item["Department"] = FinalDept; line while
file is correctly moving.
same code for MoveTo is working fine.
any solution for this ?
code is as below.
--------------------------------------------------------------------------------\
-----------------------
file.CopyTo(DestDocLibname + "/" + DestFileName, true);
file.Item["FileDescription"] = TBFileDescription;
file.Item["FileName"] = filename;
file.Item["ReportDate"] = FinalReportDate;
Site.AllowUnsafeUpdates = true;
file.Item.Update();
------------------------------------------------
and here is Error Name :
Time of Error: 5/2/2008 12:32 PM
Message: Value does not fall within the expected range.
Source: Microsoft.SharePoint
StackTrace:
at Microsoft.SharePoint.SPFieldCollection.GetField(String strName,
Boolean bThrowException)
at Microsoft.SharePoint.SPFieldCollection.GetField(String strName)
at Microsoft.SharePoint.SPListItem.SetValue(String strName, Object
value, SPField field, Boolean protectFields)
at Microsoft.SharePoint.SPListItem.SetValue(String strName, Object
value, Boolean protectFields)
at Microsoft.SharePoint.SPListItem.set_Item(String fieldName, Object value)
at AtlasReport.Form1.TransferFileEOT(String Sitename, String
SourceDocLibname, String DestDocLibname) in
C:\Inetpub\AtlasReportCode\Form1.cs:line 820
TargetSite: Microsoft.SharePoint.SPField GetField(System.String, Boolean)
--