| Mark B 2007-09-25, 7:18 pm |
| 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.AttachmentPlaceholder'."
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
|