The spfile tag has no wiki summary.
0
votes
1answer
485 views
Looking for a way to replace the File in an SPListItem
I have implemented a system for publishing documents from a document library to a Document Centre. This uses a Send To Connection set up with the "Move and leave a link" option.
When this is used the ...
2
votes
1answer
56 views
Access Anonymous to spSite.RootWeb.Folder[“xx”] in sharepoint 2010
I wrote that method to download file from document library. But When I enter site as annonymous and try to download file, "site.RootWeb.Folders["Dokumanlar"];" this code wants authentication.
In ...
0
votes
2answers
363 views
Appending text to an SPFile in document library (creating file if necessary)
Here is the setup. On error i want to write (append) the error message to an SPFile in a document library. If the file doesn't already exist i want to create it. Searching around this is what i ...
0
votes
1answer
1k views
Get all documents from a sharepoint document library
I want to retrieve all the existing documents from an SPDocumentLibrary in order to print them so I've tried this way but then I got stucked :
using (SPSite mysite = SPContext.Current.Site)
{
...
0
votes
2answers
306 views
Differentiate in ItemUpdated (ER) if file was edited or overwritted
I've an ItemUpdated Event Receiver, and I need to make different operations depending if the file was updated throw UI or overwritted. Is there any internal field that reflects this 2 different ...
1
vote
1answer
532 views
How to unlock a SPFile.SPCheckedOutStatus.ShortTerm lock on a ListItem on both Sharepoint 2007 and 2010
How can a site administrator remove a short term lock on a SPListItem.SPFile object? This happens when a user opens a Office document for editing from a list without doing a checkout. If the user does ...
0
votes
2answers
593 views
Get file from any library in the web tree
Is it possible to use some built in SharePoint API to open a file no matter which web and library it's in?
Example:
Given the file: /subsiteA/PublishingImages/myimage.jpg
I want to open it and get ...
1
vote
3answers
2k views
Getting specific SPFile from document library
I have a Document Library called "x" with file named "y". I am curious what the best way to get the SPFile object for the specified SPListItem. Currently I am using this:
...
2
votes
1answer
465 views
SPFile.OpenBinary throwing error “Cannot open file”
I have the chunk of code below:
SPListItem source = //some list item;
foreach (string file in source.Attachments)
{
SPFile oFile = source.Web.GetFile(file);
string strFilename = oFile.Name;
...
0
votes
1answer
184 views
SPFile Update fails, Exists returns true
I have a block of code wrapped in an if:
mySite.AllowUnsafeUpdates();
SPFile mySPFile = web.GetFile(someURL);
if (mySPFile.Exists) /*returns true, enters code block*/ {
//... make some updates
...
3
votes
3answers
1k views
Copying file from network to Document Library
I'm trying to save file from network location to SharePoint document library.
This is code of my method:
//parameters: string documentLibraryUrl, string filePath
FileInfo fi = new ...
2
votes
0answers
43 views
Error thrown after SaveBinary in ItemAdded event handler
I'm working on a ItemAdded event for a document library, and I'm running into this error in SharePoint 2007...
The file Lists/Shared Audit Documents/1387/Audit Report.docm has been modified by ...
1
vote
1answer
754 views
Programmaticly updating SPFileVersion.Properties Hashtable
Anyone who has experience with programmaticly updating the SPFileVersion.Properties Hashtable?
I have a special situation where I would like to modify this Hashtable.
Most of you will say: "Why on ...
0
votes
1answer
315 views
SPWeb.GetFile for an old version of file
I have a document library with enabled versioning, I added an xml file, then added it again, but I have edited one value in it. Now I would like to get the content of both files in C# to compare them. ...
2
votes
3answers
2k views
Attempt to get property CheckOutType of SPFile cause 'System.NullReferenceException' exception
I have a strange situation: If the "Require Check Out" and "Create Major Versions" options are switched on for the current Document Library, then when I try to get the CheckOutType property I receive ...
5
votes
3answers
424 views
Access binary data of an SPFile through an SPMetal generated entity
I've used SPMetal to generate my DataContext and classes for my custom Content Types. Some of these Content Types derive from Document content type.
I need to run a Linq query against a Document ...
5
votes
2answers
977 views
SPListItem.SystemUpdate updates SPListItem.File.ModifiedBy
As can be seen from the debug image when I call SystemUpdate(false) of a SPItem, that SPItem's File object's ModifiedBy attribute changes to "SHAREPOINT\system". Sorry, it's a bit weird way to ...
0
votes
1answer
293 views
using SPFile page.Exists sometimes asks user to sign in
I'm working on a custom 404 page for a new public facing SharePoint site which is replacing our current non-SharePoint site. Customers may have bookmarks that will break on the new site, simply ...
0
votes
1answer
874 views
SPFile file = web. GetFile (fileUrl); but sometimes they pass in incorrect fileUrl
Will this work or break if fileUrl is blank or does not even exists?
SPFile file = web. GetFile (fileUrl);
if (file == null)
{
file.delete()
}
0
votes
1answer
247 views
Copying a document between libraries breaks QuickParts
I am copying a file between 2 libraries which contain the same fields. So basically the source library serves as a template library. After the file is copied i update the field values in the ...
16
votes
3answers
3k views
Find Document by GUID
I'm missing something that must be so simple that it's not even worth asking... but I have an object ID (GUID)... How do I figure out the document it points to?
For example I have a GUID of ...
