Microsoft KB Archive/302206

= Accessing the MSCMS Publishing API in Perl =

Article ID: 302206

Article Last Modified on 2/22/2007

-

APPLIES TO


 * Microsoft Content Management Server 2001 Enterprise Edition
 * NCompass Resolution 4.0

-



This article was previously published under Q302206



SUMMARY
This article provides comments on accessing the Microsoft Content Management Server Publishing API in Perl.



MORE INFORMATION
The main entry point for retrieving MSCMS Publishing API objects (such as postings and channels) is through the Autosession object. Autosession is the object in the Publishing API that relies on ASP. After Autosession has been initialized with the parameters of the HTTP request via ASP, the other objects can be retrieved and manipulated as required.

Any other entry point outside of ASP would have to find another way to specify the parameters normally transmitted through the ASP intrinsic objects (Server, Request, and so on); otherwise, it would have limited capabilities, such as only working in the default mode (Published). It would also not work in conjunction with the Autosession. The Publishing API is an apartment-threaded application, and ASP provides apartments for the Publishing API to run in. Any other calling environment should do the same; otherwise, threading issues would arise.

In theory, if the other language runs under ASP and supports COM, it should be able to use the Publishing API without any problems.

If you needed access outside of ASP, the script below will send information from a Content Management Server template to a Perl script. The Perl script writes the information to a text file, and then information will be sent back to MSCMS.

MSCMS Template
Dim strVar strVar = &quot;Hello world&quot; Response.Redirect(&quot;http://server/PerlFile.pl&quot; & &quot;var=&quot; & strVar)

Perl Code
$temp=$ENV{'QUERY_STRING'}; @pairs=split(/&/,$temp); foreach $item(@pairs) { ($key,$value)=split (/=/,$item,2); $value=~tr/+/ /; $value=~ s/%(..)/pack(&quot;c&quot;,hex($1))/ge; $fields{$key}=$value; #Check to see which variable we got back $var=$fields{'var'}; } $htmlfile = &quot;c:\&quot;. &quot;sample.html&quot;; open (HTMLOUT, &quot;>$htmlfile&quot;) || die &quot;Sorry could not write to html out file&quot;; print HTMLOUT &quot;&quot;. $var. &quot;\n&quot;;
 * 1) Collect variable from querystring
 * 1) Create amd Open HTML file for writing
 * 1) Output to HTML

$query = &quot;&perl=perl&quot;; print &quot;Location: http://server/channels&quot;. &quot;?&quot;. $query. &quot;\n\n&quot;;
 * 1) Construct the querystring to send back to the MSCMS template
 * 1) Redirect back to the PerlBoard MSCMS template
 * EOF

Keywords: kbinfo KB302206

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.