Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8349233
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T07:55:58+00:00 2026-06-09T07:55:58+00:00

I try to open a file like that fromServerURL = http://mysite.com/sites/CM , it is

  • 0

I try to open a file like that

fromServerURL = http://mysite.com/sites/CM

, it is OK.

but it gave me the error when i pass the value like

fromServerURL = http://mySite.com/

SPFile file = oWebsiteFrom.GetFile(fromServerURL + "/" + fromPath + "/" + fileName);

I try to test it and see those.

long length = file .Length; - > it gives me the correct length
byte[] a= file .OpenBinary(); - > it gave me the error
file.Item is also null.

I found this link to solve the issue but it’s suited for my situation when I’ll not know the exact the folder structure.

http://blogs.msdn.com/b/momalek/archive/2011/02/28/reading-item-attachments-programmatically-spfile-openbinary-exception.aspx

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T07:55:59+00:00Added an answer on June 9, 2026 at 7:55 am

    A better description of your problem would help improve the quality of the answers but ill give it a try:

    Instead of getting the file like you’re doing now just get the listitem and then get the file from the listitem:

    SPListItem.File
    

    This way you won’t have to construct the file url like you’re doing now and you can get the listitem by using Linq/Linq2SharePoint/caml…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Whenever I try to open a file with ifstream, it compiles fine, but will
I would like to try open file without extension. When I try to open
when I try to open a file for reading in my console application i
When I try to open a file in write mode with the following code:
The problem occurs when i try to manipulate an image uploaded from sinatra. File.open(params[:file][:tempfile])
I try to open a finder window which works fine but every time I
When I try to open the following video: http://streaming1.hss-win.rpi.edu/ondemand/cogsci/issues_in_cs/issues_in_cogsci_02_04_2009.asf I can get it but
When I try to open a project's CodeAnalysis page I get the error An
Whenever I try to open .pyc or .pyo files, I always get an error
I need to create a Linked List from a text file that looks like

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.