none
problem opening the file using default name(linked to a document with edit menu) filed in document library RRS feed

  • Question

  • Hi all,

    Iam adding default name(linked to a document with edit menu) field in document library view to open the documents. But Iam unable to download the pdf doument.When iam clicking on link  it is showing error file does not begin with '%PDF-' error is showing in IE.

    please help me.thanks very much in advance.

    Regards,

    Praveen

    Wednesday, February 17, 2016 4:26 PM

All replies

  • Hi Praveen,

    Please check this

    http://sharepoint.stackexchange.com/questions/111576/sp2010-how-to-link-to-document-on-my-title-column-on-document-library


    Please remember to click 'Mark as Answer' on the answer if it helps you

    Wednesday, February 17, 2016 4:51 PM
  • thanks lakshman for u r reply.I used below code  to upload document from sourcelib to new library.

     SPDocumentLibrary sourceDocumentLibrary = (SPDocumentLibrary)web.Lists["UploadDocument"];
     SPListItem item = sourceDocumentLibrary.Items[0];
    FileInfo fi = new FileInfo(lnk1.Text);
     string fileextention = fi.Extension;
     byte[] fileBytes = item.File.OpenBinary();
      string destUrl = mylibrary.RootFolder.Url + "/" + lnk1.Text;
     string fullpath = ViewState["website"] + "/" + ViewState["site"] + "/" + ViewState["subsite"] + "/" + ViewState["subsite1"] + "/" + destUrl;
     SPFile spfile = mylibrary.RootFolder.Files.Add(destUrl, memoryStream, true);

    spfile.Item["Name"] = lnk1.Text;

    spfile.Item.Update();

    when i click on the name field it is showing error  file does not begin with '%PDF-' error.

    Please help me how to resolve this.

    Regards,

    Praveen

    Wednesday, February 17, 2016 5:18 PM
  • any help please.Thanks in advance.
    Thursday, February 18, 2016 11:42 AM
  • any help please.Thanks in advance.
    Thursday, February 18, 2016 11:43 AM