Reading an SB-Messaging Send Port properties using the Microsoft.BizTalk.ExplorerOM makes a breaking change - powershell

I am working on a PowerShell script making use of the Microsoft.BizTalk.ExplorerOM to dynamically update the SB-Messaging SAS key for BizTalk Receive Locations and Send Ports. This is to enable us to roll the SAS keys for our Service Bus queues, and update BizTalk with the new keys as painlessly as possible.
I have this working correctly for Receive Locations, but Send Ports are giving me a different issue.
As soon as I read the PrimaryTransport properties of the Send Port, it seems that some change is made under the covers, that then prevents SaveChanges from working, instead throwing an "Invalid or malformed XML data exception".
This is compared to the the ReceiveLocation, where I can read any of its properties, and then SaveChanges successfully.
Note that in both of this cases, no changes have been made by me. I am simply doing a Read, and then a Save.
Can anyone offer any advice as to what could be causing the issue, and any possible solutions to try?

Had this very same issue, when using Powershell to replace values in ServiceBus ReceiveLocations & SendPorts.
The problem is with the none valid xml symbols in the TransportTypeData, which are converted when the script reads them out in the PS cmd.
All none valid xml symbols (such as the one occuring for Namespace value, ) need to be converted to amp, and if I'm not mistaken even double amp:ed.
Here's an example article showing examples on what I mean by "double amp:ed":
How do I escape ampersands in XML so they are rendered as entities in HTML?
Hope this make sense, and if not, then let me know and I'll give it another go.

Just tried doing this from C#, seems to work ok:
var root = new Microsoft.BizTalk.ExplorerOM.BtsCatalogExplorer() { ConnectionString = "Data Source=(local);Initial Catalog=BizTalkMgmtDb;Integrated Security=SSPI;" };
var sendPort = root.SendPorts["xxxx.ServiceBusQueue"];
System.Diagnostics.Trace.TraceInformation(sendPort.PrimaryTransport.TransportTypeData);
sendPort .PrimaryTransport.TransportTypeData = sendPort.PrimaryTransport.TransportTypeData.Replace("RootManageSharedAccessKey", "MySharedAccessKey");
root.SaveChanges();

Related

I’m getting below error while I try to execute a workflow on Powercenter

Transformation Parse Warning [<<P M Parse Warning>> <<Invalid constant sun-expression>> <<Expression Error>> [TO_DATE]:invalid string for converting to Date
… t:TO_DATE(s:s:”,s:s:’YYYYMMDD’)
……….
AND SATIS_TARIHI = >>>> TO_DATE($$RUN_DATE,’YYYYMMDD’)<<<<];
How can I solve this?
This is the first time I encounter this error. Normally, this is a daily routine for our job. The parameter is successfully added to the mapping and all the other things seem okay. I’d appreciate your help.
I tried to start the workflow and got this error.
You need to define a $$RUN_DATE in mapping. Currently its not defined in mapping or its null in parameter file.
You need to set a default value in mapping like 20221221 for today.
Or else you can set it up in a parameter file like this
[folder.workflow_name]
[folder.session_name]
$$RUN_DATE=20221221
Considering this is your daily routine and up till now it has been working fine, I assume this is not a new development and no recent changes have been made. Apparantly PowerCenter got an invalid value for the parameter.
Check you parameter file and how it gets generated.
Was the process of generating paramfile executed without issues?
Was there enough storage space?
Can you verify the paramfile contents?
Can you regenerate it?
Can you modify it and provide some value manually?
Feel free to get back with some updates for more help if your problem won't get resolved by checking the items on the list above.

Can I enable / Disable an Azure Service Bus Topic using Powershell

I have spent a couple of hours search for a solution to disable my Azure Service Bus Topics using Powershell.
The background for this is we want to force a manual failover to our other region.
Obviously I could click in the Portal:
but I want to have a script to do this.
Here is my current attempt:
Any help would be great.
Assuming you're sure your $topic contains the full description, modify the status parameter in the array and then splat it back using the UpdateTopic method. I'm afraid I can't test this at present.
$topic.Status = "Disabled"
$topicdesc = $NamespaceManager.UpdateTopic($topic)
I don't think you'll need to set the entity type for the Status, nor do you require semi-colons after each line of code in your loop.
References
PowerShell Service Bus creation sample script (which this appears to be based off): https://blogs.msdn.microsoft.com/paolos/2014/12/02/how-to-create-service-bus-queues-topics-and-subscriptions-using-a-powershell-script/
UpdateTopic method: https://msdn.microsoft.com/en-us/library/azure/microsoft.servicebus.namespacemanager.updatetopic.aspx
Additional note: please don't screenshot the code - paste it in. I'd rather copy-and-paste than type things out.

Outlook meetings and rich text format

I have been working on creating appointments from Powershell in Outlook. Everything seems to be working with the exception of being able to set the appointment.RTFBODY. It looks like it is stored as a byte array, but despite my best efforts and many attempts I have been unable to set it. Any suggestions would be much appreciated.
http://pastebin.com/kQvGfNRS
Edit: I was able to find what could be a similar issue. https://social.msdn.microsoft.com/Forums/sqlserver/en-US/5dba0d12-94e8-47a5-b082-93d3693e2a47/cant-set-the-rtfbody-of-an-appointmentitem
"I assume you add a wrong version reference. If you add Microsoft.Office.Interop.Outlook 12.0, I could reproduce your issue. I suggest you remove this reference, and add Microsoft.Office.Interop.Outlook 14.0."
Also found this: Outlook AppointmentItem - How do I programmatically add RTF to its Body?
from the link in your question - "it is just a known problem in OOM - setting the RtfBody property using early binding works. Setting through IDispatch::GetIDsIfNames / Invoke does not."
Powershell always uses late bindings (i.e. you cannot declare a variable as an instance of a particular object. e.g. AppointmentItem).

Why would LayoutObjectNames return an empty string in FileMaker 14?

I'm seeing some very strange behavior with FileMaker 14. I'm using LayoutObjectNames for some required functionality. On the development system it's working fine. It returns the list of named objects on the layout.
I close the file, zip it up and send it to the client, and that required functionality isn't working. He sends the file back and I open it and get a data viewer up. The function returns nothing. I go into layout mode and confirm that there are named objects on the layout.
The first time this happened and I tried recovering the file. In the recovered file it worked, so I assumed some corruption had happened on his end. I told him to trash the file I had given him and work with a new version I supplied. The problem came up again.
This morning he sent me the oldest version that the problem manifested in. I confirmed the problem, tried recovering it again, but this time it didn't fix the problem.
I'm at a loss. It works in the version I send him, doesn't on his system. We're both using FileMaker 14, although I'm using Advanced. My next step will be to work from a served file instead of a local one, but I have never seen this type of behavior in FileMaker. Has anyone seen anything similar? Any ideas on a fix? I'm almost ready to just scrap the file and build it again from scratch since we're not too far into the project.
Thanks, Chuck
There is a known issue with the Get (FileName) function when the file name contains dots (other that the one before the extension). I will amend my answer later with more details and a possible solution (I have to look it up).
Here's a quote from 2008:
This is a known issue. It affects not only the ValueListItems()
function, but any function that requires the file name. The solution
is to include the file extension explicitly in the file name. This
works even if you use Get (FileName) to return the file name
dynamically:
ValueListItems ( Get ( FileName ) & ".fp7" ; "MyValueList" )
Of course, this is not required if you take care not to use period
when naming your files.
http://fmforums.com/forums/topic/60368-fm-bug-with-valuelistitems-function/?do=findComment&comment=285448
Apparently the issue is still with us - I wonder if the solution is still the same (I cannot test this at the moment).

How to set the file name of a Word document without saving it from c# and automation II

I have asked here a question on how setting the filename of a Word document via automation without saving it. Thanks to Remou, I have received a nice way doing this via calling the FileSummaryInfo-Dialog and setting the Title-property.
However now I have the problem that the client wants to have document names with special chars in (point and underscore) and it seems to be a bug (or a feature) of word, that it cuts the title and only takes the chars before the first special char for building the file name! I have already googled a lot, however was not able to find a resolution for this problem.
The problem is also noticed here (see under gotcha), however without a solution.
Has anybody another solution for setting the filename without saving, or a workaround/bugfix for the mentioned odd behavior?
Try easyhook, since do not have Windows machine besides my hand these days.
following is just the call flow (something like what i did years ago, changed a software's socket bind port to different one by Detours)
About Hook the CreateFileW:
The example in the easyhook's wiki is just what we want here.
CreateFileHook = LocalHook.Create(
LocalHook.GetProcAddress("kernel32.dll", "CreateFileW"),
new DCreateFile(CreateFile_Hooked),
this);
In the CreateFile_Hooked you can change the parameter InFileName, then call real CreateFileW
static IntPtr CreateFile_Hooked(
String InFileName,
UInt32 InDesiredAccess,
UInt32 InShareMode,
IntPtr InSecurityAttributes,
UInt32 InCreationDisposition,
UInt32 InFlagsAndAttributes,
IntPtr InTemplateFile)
{
// FIGURE OUT THE FILE NAME THAT YOU WANT HERE
// IF the InFileName is not your Document name "My.doc", then call orignal CreateFile
// with all the parameter unchanged.
// call original API...
return CreateFile(
YOUR_CHANGED_FILE_NAME_HERE,
InDesiredAccess,
InShareMode,
InSecurityAttributes,
InCreationDisposition,
InFlagsAndAttributes,
InTemplateFile);
}
Call flow:
After you changed the title to "My_Document_2012_11_29",
then hook the CreateFileW of Word process.
For example when the InFileName is "My.doc",
then you should change it to "My_Document_2012_11_29".
Because this is done in the Word process, so the Detoured function do not know
"My.doc" is mapping to "My_Document_2012_11_29".
There is lot ways to get this mapping info, one is save this mapping info to
a known file in your app, and read the file in the Detoured function.