I needed a list of files from a huge directory of file for certain companies, and the company name was the prefix of the filename.

The company names are added to an array of strings.  This script recursively gets all filenames in a given directory, tests them to see if the start with any of the given prefixes, then writes to the console and to a given filename.


$dir = "c:\Integrations\InvoiceOut\FTP\"
$outputFilename = "d:\scripts\selectedFiles.txt"

if (Test-Path $outputFilename)
    #since we are appending to end of file, clean out the file on each run 
    #(or alternative put a date/time in the filename) 
    Remove-Item $outputFilename

$prefixes = @()   #create new empty array 
$prefixes += "test1"
$prefixes += "test2"
$prefixes += "abc"
$prefixes += "def"
#put as many prefixes as you wish here... 

$files = get-childitem -path $dir -recurse -file
foreach ($file in $files)
    $parts = $file.BaseName.Split("_")   #my files were in format prefix_date_other.txt
    if ($prefixes -contains $parts[0])
       Write $file.Name #write to console
       Add-Content -Path $outputFilename $file.Name #write to file


Note: You could also use $file.FullName to get the entire file name including the directory.
$file.BaseName is the file name without the directory and without the extension.
$file.Name is the file name without the directory (but with the extension).

If your filenames don’t have names like mine: CompanyName_text_text_text.txt, then you could do two loops.
One to loop through the prefixes and then to and use the C# string.StartsWith method to see if the file starts with that prefix. (Or instead of a prefix, maybe your search terms could be anywhere in the filename, use the C# string.IndexOf).

#first part would be same as above 

$files = get-childitem -path $dir -recurse -file 
foreach ($file in $files) 
       foreach ($prefix in $prefixes) 
           if ($file.Name.StartsWith($prefix))   
           # or to search anywhere in filename: if ($file.Name.Indexof($prefix) -gt 0) 
                 Write $file.Name  #write to console 
                 #Add-Content -Path $outputFilename $file.Name #write to file 

BTDF deploy on local machine in Visual Studio by using “Tools”, “Deployment Framework for BizTalk”, “Deploy BizTalk Solution” failed with the following error in XmlPreprocess.exe

/s:: Argument expects a parameter

What caused the error for me was that I in the SettingsFileGenerator.xml spreadsheet, I had renamed all the “Settings File Names” for each environment.  I switched the “Local Development” back to Exported_LocalSettings.xml and this got around the issue.

Perhaps there is a setting in the .btdfproj file that allows you to specify (override) the local settings name, but I couldn’t find it today.




When I tried to modify the “Document schemas” (Collection) property on an XML Validation Pipeline Component, I got this error:

I don’t have the total solution, but the problem was that I had an EDI210 standard schema and an EDI210 custom schema.
When the custom schema was added as a reference at the same time as the standard one, then this error occurs on all XML Validation pipeline components in the project. Apparently some properties overlap.

Document namespace is a combination of name and assembly of the schema, separate by a comma (and a space).

Step-1. To find this you need to go to BizTalk Admin console then navigate to the application where you have deployed your schema DLL. Click on the Schemas (in the tree structure on the left) to list all schemas. Sort them as needed to find your schema. (It has to be deployed for this to work.)

Step-2. Double click on the schema for which you want the Document Spec Name; you will find “General” tab on the left hand side of the window.

Step-3. On this General tab, “Name”, “Assembly” and “Type” would be listed, read-only, but you can copy-paste from them.

Step 4 – Open NotePad++ or your favorite editor,
a) copy the value from “Name”,
b) type a comma followed by a space
c) copy the value from “Assembly”

Example from above:

Name: DemoSchema.Sample1
Assembly: DemoSchema, Version=, Culture=neutral, PublicKeyToken=984c0907a0e7fc84

Thus, the created document spec name would be:
DemoSchema.Sample1, DemoSchema, Version=, Culture=neutral, PublicKeyToken=984c0907a0e7fc84

Above steps taken from https://stackoverflow.com/questions/12319987/documentspecnames and elaborated a little.

NOTE: You can also get the Target Namespace from this screen.
If you want to filter on a message by MessageType, use the pattern namespace#rootElement.

Log4Net allows you to customize your output files with various parameters.

For example:

<conversionPattern value="%property{logLocation}\Logs\MyProgram.log.%date{yyyyMMdd-HHmm} processid[%processid]  job[%property{jobType}].txt" />

It will show something like “job[LoadJob]” or “job[Whatever] based on your custom property called “jobType”.

This is a custom property which is set as follows.

GlobalContext.Properties["jobType"] = currentProcessorType;  // or some literal value 

Error when running from BizTalk run time environment: Exception from HRESULT: 0x80131942
(no other details were provided)

Exact error when running “Test Map” in Visual Studio: Does not contain a matching ‘GetTimestamp’ method that has 0 parameter(s).

I was transferring a BizTalk map from 2010 to 2013.

There was an XSLT inline that had the following:

<xsl:variable name="timeStamp" select="userCSharp:GetTimestamp()"/>

and had this C# function:

<ScripterCode><Script Language="CSharp">
<![CDATA[public string GetTimeStamp()
DateTime date = DateTime.Now;
return date.ToString("HH:mm");

It turns out in my particular case, the function name didn’t actually match, the “s” of “GetTimeStamp” either needed to be capitalized or lower case in both places where it is used.

This blog also shows how to get the time within an XSLT function (in a BizTalk map).

When importing bindings into an application, you might get this error:
Failed to update binding information (mscorlib):
Additional Information
BizTalk Import Bindings Error: Object reference not set to an instance of an object. (Microsoft.BizTalk.ExplorerOM)

While there maybe multiple reasons for this error, here’s the one I found.

The map I was referencing in a Receive Port existed, but it was in a different solution. (I had a typo in the application name when I deployed it). I either move the map from one application to another, or delete it and re-deploy it with the correctly spelled name. Then it worked fine.