Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

Value does not fall within expected range for wss 3.0

  Asked By: Alexandria    Date: Mar 05    Category: Sharepoint    Views: 3432

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;
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
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)




4 Answers Found

Answer #1    Answered By: Latisha Schneider     Answered On: Mar 05

Need to see more code. Where is FinalDept from? Does the destination doc  library
have a "Department" column?

Answer #2    Answered By: Nora Maxwell     Answered On: Mar 05

Yes the destination library have the same columns as mention.
but source  doesn't have i am adding some metadata externally i.e from
other table
for single file  it is working  using moveTO method not working using
copyTo method.

Answer #3    Answered By: Corina Duran     Answered On: Mar 05

It can't copy what is not there. Maybe you can copy the file  without the Column
and then update  the column after the document is in the new location.

Answer #4    Answered By: Irving Hurley     Answered On: Mar 05

Well i am doing same thing for the file  copy but still it doing same error.

what i observed in wss  3.0 object  model for the CopyTo method that it
will copy the file along with metadata,
but in my case i want some other metadata to be added in destination
document library with some other metadata.
It may be happen that the file may have multiple entries with
different metadata but changing the names during copy process to
create the unique file name because in my case the is multiple
department for same file so i am download the file at physical
location and then copy that file to Destination document library along
with metadata,

is there any copyto and moveto functional changes in wss 2.0 and wss 3.0 ?

Didn't find what you were looking for? Find more on Value does not fall within expected range for wss 3.0 Or get search suggestion and latest updates.