Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Getting CMSObject based on Posting:

0 views
Skip to first unread message

Varad

unread,
Jan 10, 2005, 5:09:06 PM1/10/05
to
Hi Stefan
I'm passing the name of the posting to a CMStemplate through query string.
In this template I want to get the CMS collection (includes all placeholders)
for that posting. How do I do this? I looked through the PAPI guide, but
coudnt locate this one. Thanks
V

Angus Logan [MVP]

unread,
Jan 10, 2005, 6:53:54 PM1/10/05
to
Hi,

The Posting object (that contains a collection of placeholders among other
things) can be loaded by its path using the Searches object.

You need to check out the Searches.GetByPath method
(http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sitedevl/htm/frlrfmicrosoftcontentmanagementpublishingsearchesclassgetbypathtopic.asp)

Regards
--
________________________________________

Angus Logan (MCAD/MCDBA/MCP/MVP for MCMS)
Product Specialist
Microsoft Application Solutions
Data#3 Limited
E angus...@data3.com.au
BLOG www.anguslogan.com
________________________________________
"Varad" <vara...@gmail.com> wrote in message
news:08A88CBA-4B24-4DA2...@microsoft.com...

Varad

unread,
Jan 10, 2005, 7:59:01 PM1/10/05
to
Thanks Angus. I greatly appreciate your help.

Varad

unread,
Jan 11, 2005, 2:09:02 PM1/11/05
to
Hi Angus I'm getting an error trying to search by posting. Can you please
tell me what the error is:

Dim curPostingPath = Request.QueryString("CurPath")
Dim curPostingName = Request.QueryString("posting")
Dim curPostingObject As Searches
Dim newObject As Object = curPostingObject.GetByPath(curPostingPath)

I'm getting the error "Object reference not set to an instance of an
object." where I'm doing the GetByPath.
Thanks.

Stefan [MSFT]

unread,
Jan 11, 2005, 3:01:47 PM1/11/05
to
Hi Varad,

that usually indicates that either the path does not exist or the current
user does not have rights to this channel.

Cheers,
Stefan.


"Varad" <vara...@gmail.com> wrote in message

news:F514AB27-DBF0-40D8...@microsoft.com...

Varad

unread,
Jan 11, 2005, 3:27:04 PM1/11/05
to
So my syntax is right? But the path exists. I have a posting test 7 under
channel main. So the path I'm passing is /Channels/main/test7. That is a
valid path. The same user was able to post the posting. Why would user rights
be an issue now? I'm not sure if that is the case here. Thanks for your time
Stefan.

Varad

unread,
Jan 11, 2005, 6:05:04 PM1/11/05
to
I found out why I was getting the error. I forgot to instantiate a new
CMsApplicationContext! I'm able to retrieve the posting now.

Dim curPostingPath = Request.QueryString("CurPath").ToString
Dim curPostingName = Request.QueryString("posting").ToString

Dim curPostingObject As Searches
Dim cmsAppCtx As CmsApplicationContext
->>Added this: cmsAppCtx = New CmsApplicationContext

cmsAppCtx.AuthenticateAsCurrentUser(PublishingMode.Published)
Dim newObject As Posting = cmsAppCtx.Searches.GetByPath(curPostingPath)

0 new messages