Getting attachment placeholder URL using CmsApplicationContext
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Web Servers reviews > Microsoft Content Management Server > Getting attachment placeholder URL using CmsApplicationContext




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    Getting attachment placeholder URL using CmsApplicationContext  
Mark B


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
09-26-07 12:18 AM

Hi All,

I'm working on a windows app that will interact with MCMS. The problem
I'm working on is getting the URL of an attachment. I know that the
typical way to do it in a web app would be to use:

string Url = ((AttachmentPlaceholder)
(CmsHttpContext.Current.Posting.Placeholders["Attachment"])).Url;

The problem is that I'm in a windows app and ther is no
cmsHttpContext. I tried the following:

string Url = ((AttachmentPlaceholder)
(cmsPosting.Placeholders["Attachment"])).Url; (where cmsPosting is the
actual posting inside the CmsApplicationContext)

This generates the following:

System.InvalidCastException was unhandled
Message="Unable to cast object of type
'Microsoft.ContentManagement.Publishing.InvalidPlaceholder' to type
'Microsoft.ContentManagement.Publishing.Extensions.Placeholders.AttachmentPl
aceholder'."
Source="updateMenuXml"

Here's what MS says about this:

An InvalidPlaceholder and InvalidPlaceholderDefinition represent a
Placeholder that cannot be instantiated because its assembly cannot be
loaded.

The assembly cannot be loaded for one of the following reasons:

The assembly was removed from the machine.

The assembly was upgraded and the old version was deleted.

PlaceholderDefinition instances are bound to the specific version of
the assembly which was used to create the PlaceholderDefinition object
in the first place. If you have an updated assembly which you are
confident is backward compatible with the assembly that was used to
create the PlaceholderDefinition and Placeholder, you can install a
policy file to map the old version to the new version.

If the new version of the assembly is not backward compatible with the
old version of the assembly, you must write a program or script that
performs the following steps:

Instantiate all Placeholder instances using the old version of the
assembly.

Create PlaceholderDefinition objects using the updated assembly.

Copy all of the data over from the old PlaceholderDefinition objects
to the new PlaceholderDefinition objects.

Remove the old PlaceholderDefinition objects from the Template.

Add the new PlaceholderDefinition to the Template.


I checked to see that the assemblies are the same in both the web app
and the windows app. I've beat around on this for two days now and I'm
just flat out stumped. Any ideas will be most appreciated.

Thanks,

Mark B






[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 08:28 PM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register