.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

downloading file from sharpoint 2007 with fba authentications

Posted By:      Posted Date: October 05, 2010    Points: 0   Category :SharePoint


I have to write a program which will automatically download some files from sharepoint 2007 with FBA.

The most important for me is how to autheticate form c# to sharepoint FBA through http.


View Complete Post

More Related Resource Links

While Importing Excel 2007 file to Datatable - headerrow problem


Hi there,


I am trying to simply extract an excel data from an uploaded file an put it into a datatable. In this case the excel file has 3 rows but when I fill the datatable I only see row count of 2.

I tried changing HDR:NO; to HDR:YES and vice versa, but no luck. 

What am I doing wrong? (Note: the excel file cannot have a  headerrow)


string connstr = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + pFilePath + ";Extended Properties=\"Excel 12.0;IMEX=1;HDR:NO;\"";
            OleDbConnection conn = new OleDbConnection(connstr);
            DataTable dtTables = conn.GetOleDbSchemaTable(System.Data.OleDb.OleDbSchemaGuid.Tables, null);
            string strTablename = dtTables.Rows[0]["TABLE_NAME"].ToString();
            string strSQL = "SELECT * FROM [" + strTablename + "]";

            OleDbCommand cmd = new OleDbCommand(strSQL, conn);

            DataTable dt = new DataTable();
            OleDbDataAdapter da = new OleDbDataAdapter(cmd);
            //At this point row count=2 which doesn't make sense




OpenSearch Descriptor File Generator for SharePoint Server 2007 Sites

Learn about the OpenSearch Location Builder Tool, which you can use to create an OpenSearch Description (.osdx) file to connect SharePoint Server 2007 sites to the Windows Client via the OpenSearch protocol.

Problem in downloading a file code.

hey dere, here is my code.....   void transfer() { string filePath = Server.MapPath("~/download"); string _DownloadableProductFileName = "mob.txt"; System.IO.FileInfo FileName = new System.IO.FileInfo(filePath + "\\" + _DownloadableProductFileName); FileStream myFile = new FileStream(filePath + "\\" + _DownloadableProductFileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite); string lastUpdateTiemStamp = File.GetLastWriteTimeUtc(filePath).ToString("r"); string _EncodedData = HttpUtility.UrlEncode(_DownloadableProductFileName, Encoding.UTF8) + lastUpdateTiemStamp; Response.Clear(); Response.Buffer = false; Response.AddHeader("Accept-Ranges", "bytes"); Response.AppendHeader("ETag", "\"" + _EncodedData + "\""); Response.AppendHeader("Last-Modified", lastUpdateTiemStamp); Response.AddHeader("Content-Disposition", "attachment;filename=" + FileName.Name); Response.End(); Label1.Text = "hel"; } i have two problems in this code.First while running this code i dont get the file damaged or corrupt. Second problem is dat the code exits at Response.End() and doesnt execute d last line... 

Downloading a .pdf file

Hi. I have a link button which the user clicks on it and will download a .PDF file into their PC.It is  just a file for them to download.Currently, I have the following code.Response.Clear()                Response.Buffer = True                Response.AddHeader("content-disposition", "attachment;filename=Savings Account eStatement.pdf")                Response.Charset = ""                Response.ContentType = "application/vnd.pdf"                Dim objSw As New StreamWriter("Savings Account eStatement.pdf")                objSw.Close()                lblMsg.Text = "Your file created successfully"                lblMsg.ForeColor = Color.Green              

file size increase when moving from file system to sharepoint 2007

Hi, While moving files from file system to Sharepoint 2007 via windows explorer view, why do file sizes increase? thanks, Burcu  

Windows 7, Office 2007, and WSS 3.0: Losing file path when saving to Document Library.

A client of ours recently purchased 5 desktops with Windows 7 and Office 2007.  They use Sharepoint to share all documents for their company. The computers that have Windows XP on them can browse the Sharepoint site, open documents (read only or edit), and chose to Save or Save As.  A new window pops open with their current file path of the Sharepoint Document Library so they can save the file in the same folder they opened it from.  I have tested this with Office 2003 and 2007 (Word and Excel) on XP and it always works. The 5 new desktops running Windows 7 cannot do this.  When a user opens a document by browsing to it from Internet Explorer and chooses to Save or Save As, they are kicked back to their last successful save point (usually My Documents or Desktop). The current work around is mapping a drive to the root Document Library directory and having them traverse through the folders to save it back in the original location. I've tried changing the Check Out save settings in Word 2007 and Excel 2007 to edit directly on the server, but I run into the same problem.  I've also made sure that IE sees the site as a Local Intranet site and Protected Mode is off. Any help would be appreciated.  Thanks in advance.

How to stop or correct Sharepoint 2007 modifying file locations


I have a Word document that is located at non-Sharepoint location XYZ. This word document has multiple hyperlinks contained within the body of the document. When I try and load this document to a document library it first changes the XYZ location of the original document to the location where Sharepoint resides. THEN, it modifies ALL of the hyperlinks to a subset of the Sharepoint location. I am at my wits end as to how to stop this from happening.


Original File location  Z:\Power\Procedures\somedocument.doc

After upload http:\\ap15\power\procedures\somedocument.doc

The ORIGINAL document is basically a Table of Contents that is several pages long and has several hundred links pointing to different file locations embedded within the body.

I am totally baffled as to how to stop this from happening. At some point all of the documents will get moved to the Sharepoint server, but in the interim I just want to link to the old document, in the old location, with the original links such that everyone isn't going crazy that our procedures are missing in action. HELP.

Office.sharPoint.Server Event ID: 6482 Could not load file or Assembly


Event Type: Error
Event Source: Office SharePoint Server
Event Category: Office Server Shared Services
Event ID: 6483
Date:  4/16/2009
Time:  2:41:10 PM
User:  N/A
Computer: JPFS02
Application synchronization failed for Microsoft.Office.Server.Administration.UserProfileService.

Reason: Could not load file or assembly 'Microsoft.Office.Server.Search, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c' or one of its dependencies. The system cannot find the file specified.

Techinal Support Details:
System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Office.Server.Search, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c' or one of its dependencies. The system cannot find the file specified.
File name: 'Microsoft.Office.Server.Search, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c'
   at Microsoft.Office.Server.UserProfiles.SRPSite.SynchronizeManagedPropertyMappings()
   at Microsoft.Office.Server.UserProfiles.SRPSite._Init(ServerContext serverContext)
   at Microsoft.Office.Server.UserProfiles.SRPSite..ctor(ServerContext serverContext)
   at Microsoft.Office.Server.Administration.UserProfileApplication.get_ProfileSiteCache()
   at Microsoft.Office.Server.Administration.UserProfileApplication.Synchronize()<

Downloading a document from a sharepoint site to local file system, copy web service returns null

Hi Guys,
               I am trying to get this done for the last 2 days and I am still banging my head to the wall.
All I need to do is to download files from my sharepoint site library that uses integrated windows authentication. I was using copy webservice : getItem method to accomplish this.

CopyService.GetItem(copySource, out myFieldInfoArray, out myByteArray);

Problem : myByteArray is always returned as NULL

Note: I have tried the same with another site that uses forms authentication but the result was the same (NULL !!)

This is my code:


Copy copy = new CopyService.Copy();


Im downloading a file and checking internet connection im trying to use event to check when the file


I used breakpoint on the event but its never get there.

This is the code of the connection testing of the internet while downloading the file in the contrustor:

if (fdt.http_test()== true)
                    Client.DownloadFile(remote_image_on_server, temp_dir + temp_file);
                    label6.Enabled = true;
                    label6.Visible = true;
                    label6.Text = "Internet connection active";              

OPENROWSET on Excel 2007 file



I am seriously loosing hair over this one! I have successfully used OPENROWSET to query data in an Excel 2003 file (*.xls) in SQL Server, however I am now looking to replicate this functionality with an Excel 2007 (*.xlsx) file.


I have tried the usual google searches but nothing concrete seems to come up, can anyone give me any pointers?


My Excel 2003 file sql is as follows: (works great)


SELECT * FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0','Excel 8.0;Database=C:\test.xls',

Unable to open an Excel File in Sharepoint MOSS 2007


I am unable to open an excel file in Sharepoint (MOSS 2007). All other documents work fine. As far as I know there was no change on the Server at all.

Excel found unreadable content in 'stuff.xls'. Do you want to recover the contents of this workgroup? If you trust the source of this workbook , click Yes

When I click YES >> It says "Excel recovered your formulas and cell values, but some data may have been lost." And then a link to an xml file , which reads :

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
- <recoveryLog xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main">
  <summary>Errors were detected in file 'http://server_name/Project_name/Shared Documents/abc - def/Phase 5/Track/stuff.xls'</summary>
- <additionalInfo>
  <info>Excel recovered your formulas and cell values, but some data may have been lost.</info>

Now this has resulted in huge loss of data and I can see New numbers in the cells which is very strange!

Is there a way I can get it back ? I do not have a

Sharepoint 2007 publishing site home page displays unknown file type security message


I am using sharepoint 2007 sp2, it has been workig fine for the past 8 months but since one of the developers installed .net 4.0 framework, every time we create a new sharepoit publishng site or extend and existing application the home url displays an "Unknown File Type" security warning message and asks users to download the file.  If i manually tupe in the full url http://www.mysite.com/pages/default.aspx it is displayed correctly. I have uninstalled .net 4 from the server but i still have the same  error. I have tried to replicate this error on a development server but sharepoitn works fine on that even with .net 4.0 installed.

Has anyone had the same issue ? I would appreciate  any suggestios or help with troubleshootig this issue.


Infopath 2007 form error - Selected file is too large


We are using Inforpath form to capture some metadata along with couple of file attachments. We implemented that and its working fine

When we tested by trying to upload file more than 5 MB we got the following error

"The selected file is too large and is causing the form to exceed the amount of allowable resources. Select Another File"

During its analysis we found that this can be resolved by changing one of the "Infopath forms service " configuration named "Maximum size of form session state".

Is there any issue (like performance issues) in increasing this limit to allow us to upload the large attachment


In other words

In the Maximum size of form session state text box, type the maximum session state size in kilobytes. Form-filling sessions that exceed this value will terminate, an error message will be generated, and all form data entered during the session will be lost. The default value is 4096 kilobytes.

If I make this value to 10240 kilobytes (10 MB) ; will this cause any performance issues ??

Using a shared Class file with InfoPath 2007


I'm a total newbie to InfoPath 2007 Forms development which should be evident by the question that follows.

I'd like to create a file containing common functions that any developer here can add to their InfoPath 2007 code behind with a using statement. I'm not sure where this file would be stored. We publish our forms to a SharePoint library. I have written these in asp.net but am not sure how to get started with this in InfoPath development. Could anyone here give me some direction o nthis?



how to do checkin,checkout,undocheckout,delete operations for sharepoint 2007 document library file


i hope your understood my problem...

please suuggest me with your coading skills.....

thanks & regards



ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend