About      |       Articles      |      Services      |      Software      |      Contact

Latest Free SharePoint Software

ARB Security Solutions regularly releases free SharePoint software, including WebParts, Client Applications, Framework Extensions, and other Miscellaneous Components.
The most recent freeware is:

Title: Simple SharePoint Rollup WebPart
Date Published: 10/22/2009

Previous Two Free WebPart Releases:

SecureCenter For SharePoint

By SharePoint security integrators, for SharePoint security integrators.

SharePoint Security Assurance Program™

For externally facing SharePoint deployments, security is an acutely important deployment concern. Learn how through daily security scanning, you can ensure external business users and partners that they can collaborate in confidence!

Security Assurance WebPart:



How To Open An SPFile To Access Content

Another question was asked in the newsgroups about how to get access to an SPFile object, and once that is object is harnessed, how to open the file in a binary read.

In order to go this, you should setup a new method that is taking a string parameter which will lead to the SPFile object. Decorate your method with public byte[] GetFileContent(string [parameter you want to name for the path to your file])
This will be used in the first part of the method when you getting a hold of the SPFile object:

C#:
  1. SPFile oFile = oWeb.GetFile([parameter representing path to your file]);

Once you have referenced that file, it is a good practice to test whether the file exists:

C#:
  1. if (oFile.Exists)

Then if it doesn't fart at this point, complete the return to open the file in binary format:

C#:
  1. if (oFile.Exists)
  2. {
  3. return oFile.OpenBinary();
  4. }

Then componesate for the if/else statement, by completing the method as such:

C#:
  1. else
  2. {
  3. return ((byte[]) null);
  4. }

That should do the trick!

  • Share/Bookmark

1 Comment »

  1. [...] How To Open An SPFile To Access Content [...]

    Pingback by Links (7/22/2007) « Steve Pietrek’s SharePoint Stuff — July 22, 2007 @ 5:28 pm

RSS feed for comments on this post. TrackBack URL

Leave a comment