none
File Name changes when reading from Sharepoint RRS feed

  • Question

  • HI

    I am using a WSS and reading a file from SharePoint 2016 and when i try to send the file to a folder using file adapter i am unable to get the same name . I don't use orchestration. The file name changes even when i specified  %SourceFileName% in the file adapter. Is there any way to maintain the same file name what i upload to sharepoint ?

    Tks

    Tim


    • Edited by TimMat Friday, August 10, 2018 6:22 PM
    Friday, August 10, 2018 6:21 PM

Answers

  • that's what I mentioned

    Create a custom pipeline component; it will be a very simple component; nothing fancy

    within this component you have to : 

    a. Read the "FileName" by this :

    string FileNameFromSharePoint = inMessage.Context.Read("FileName", "CopyPasteFromTheSusPendedMessage") 

    b. Write FileNameFromSharePoint to FileReveivedName context

    inmsg.Context.Write("ReceivedFileName", "http://schemas.microsoft.com/BizTalk/2003/file-properties", FileNameFromSharePoint);
    Now you can use the Macro %SourceFileName% in your port and will work

    • Edited by Ankur Billore Saturday, August 11, 2018 12:42 PM
    • Marked as answer by TimMat Sunday, August 12, 2018 12:11 PM
    Saturday, August 11, 2018 12:40 PM

All replies

  • Just stop the send port and see under which context property the actual file name is available.

    this Macro %SourceFileName% is not just anything; this is mainly used to read this context property FILE.ReceivedFileName 

    If WSS adapter is putting the file name in some other context property; you can read that context and just write that value in the FileName context. Then your Macro will work.

    Actually, if you set the fileName in the send pipeline, you don't even need to use this Macro as well since you will be setting that in the send side.

    Reference : https://stackoverflow.com/questions/7084841/setting-the-output-file-name-in-a-biztalk-send-port


    %SourceFileName% Name of the file from which the File adapter read the message. The file name includes the extension and excludes the file path, for example, Sample.xml. When substituting this property, the File adapter extracts the file name from the absolute file path stored in the FILE.ReceivedFileName context property. If the context property does not have a value—for example, if a message was received on an adapter other than the File adapter—the macro will not be substituted and will remain in the file name as is (for example, C:\Drop\%SourceFileName%). 

    Note: Correct implementation of this macro requires that the output message is the same message as the received message.



    Saturday, August 11, 2018 4:12 AM
  • hi

    if you see my screen shot Filename is the context property that holding the filename. but when i try to add that

    in the adapter still i could not get the file name. Its just writes %FileName%

    Pls advice


    • Edited by TimMat Saturday, August 11, 2018 10:09 AM
    Saturday, August 11, 2018 10:06 AM
  • I will assume a custom pipeline component can retreive the context propertiy and set the file name you need

    /Peter


    When asking a question please be as thoroughly as possible this will make it easier to assist you http://www.catb.org/esr/faqs/smart-questions.html

    Saturday, August 11, 2018 12:37 PM
  • that's what I mentioned

    Create a custom pipeline component; it will be a very simple component; nothing fancy

    within this component you have to : 

    a. Read the "FileName" by this :

    string FileNameFromSharePoint = inMessage.Context.Read("FileName", "CopyPasteFromTheSusPendedMessage") 

    b. Write FileNameFromSharePoint to FileReveivedName context

    inmsg.Context.Write("ReceivedFileName", "http://schemas.microsoft.com/BizTalk/2003/file-properties", FileNameFromSharePoint);
    Now you can use the Macro %SourceFileName% in your port and will work

    • Edited by Ankur Billore Saturday, August 11, 2018 12:42 PM
    • Marked as answer by TimMat Sunday, August 12, 2018 12:11 PM
    Saturday, August 11, 2018 12:40 PM
  • Needs to be on the send port not the receive location
    I assume the image is from a receive location?

    /Peter


    When asking a question please be as thoroughly as possible this will make it easier to assist you http://www.catb.org/esr/faqs/smart-questions.html

    Sunday, August 12, 2018 8:15 AM
  • Peter - This is on the send port .

    Tim

    Sunday, August 12, 2018 8:45 AM
  • In you original question you mentioned a send port and the File Adapter

    Looks like the Windows SharePoint Services Send Port does not support some standard BTS file name macros

    Check your options here
    https://docs.microsoft.com/en-us/biztalk/core/how-to-configure-a-windows-sharepoint-services-send-port

    /Peter



    When asking a question please be as thoroughly as possible this will make it easier to assist you http://www.catb.org/esr/faqs/smart-questions.html

    Sunday, August 12, 2018 9:04 AM
  • hi Peter

    Thats true.. i have too check two things

    1. When i send file to Sharepoint i want to maintain the same file name but the macros are not getting supported and hence i created a pipeline component and thats failing..

    2. Also when i receive file from Sharepoint also i need to get the samefile name. Am yet to create a component.

    Tks

    Tim

    Sunday, August 12, 2018 9:43 AM
  • Its working now perfectly.. Thanks a lot ITGuy..!!!

    string FileNameFromSharePoint = context.Read("Filename", "http://schemas.microsoft.com/BizTalk/2006/WindowsSharePointServices-properties").ToString();
                    pInMsg.Context.Write("ReceivedFileName", "http://schemas.microsoft.com/BizTalk/2003/file-properties", FileNameFromSharePoint);
    

    Sunday, August 12, 2018 12:11 PM
  • HI 

    Just one question am doing reverse like writing to Sharepoint and if so the where will i set the macro in the configuration. pls advice

    Ths

    Tim

    Sunday, August 12, 2018 1:21 PM