Get umbraco context in another web project Options
stiansol
Posted: Saturday, August 16, 2008 11:47:59 AM
Rank: Newbie

Joined: 8/16/2008
Posts: 8
Location: Norway - Oslo
How do I initialize the umbraco context in the API?
I need to reuse the content outside umbraco environment.

Stian

Want easy Ajax in Umbraco?
Download and test with Gaia Ajax - http://gaiaware.net
Open Source
Dirk
Posted: Saturday, August 16, 2008 11:58:56 AM

Rank: Addict

Joined: 9/27/2007
Posts: 977
Location: Belgium
Hi Stian,

Don't think is necessary to 'initialize' the umbraco contenxt!
All content is stored in db (versioning, ...) and on file system as xml file (caching, ...)

And using the existing API, or creating your own statements, you can get all the data you need!

Hope that helps.

Regards,
/Dirk




level 1 certified - umbraco blog at netaddicts.be - working on an integrated forum4umbraco
stiansol
Posted: Saturday, August 16, 2008 12:03:56 PM
Rank: Newbie

Joined: 8/16/2008
Posts: 8
Location: Norway - Oslo
Thanks for quick reply. Hmm.
I have this code:

Code:
umbraco.presentation.nodeFactory.Node node = node = new Node(1053);


Get this error message.
"The type initializer for 'Nested' threw an exception."

Ah! What I haven't done is to setup up connection strings in the web.config. Guess that must be at place at least. Wil try that now.

Stian

Want easy Ajax in Umbraco?
Download and test with Gaia Ajax - http://gaiaware.net
Open Source
stiansol
Posted: Saturday, August 16, 2008 12:07:44 PM
Rank: Newbie

Joined: 8/16/2008
Posts: 8
Location: Norway - Oslo
The question might then be: what is the minimum setup in a non umbraco default installation to get access to the API?

Want easy Ajax in Umbraco?
Download and test with Gaia Ajax - http://gaiaware.net
Open Source
Dirk
Posted: Saturday, August 16, 2008 12:18:56 PM

Rank: Addict

Joined: 9/27/2007
Posts: 977
Location: Belgium
Good question.

Can't really tell as I haven't done that yet.

I guess you just need to reference the umbraco dll's that are required for you to do the job!

It would be nice to give feedback on how things went, so we (as in the community) might also learn from this.

[Edit] And if you really need to do some deep debugging, grab the latest changeset from Codeplex. [/Edit]

Good luck.

Regards,
/Dirk


level 1 certified - umbraco blog at netaddicts.be - working on an integrated forum4umbraco
stiansol
Posted: Saturday, August 16, 2008 12:25:00 PM
Rank: Newbie

Joined: 8/16/2008
Posts: 8
Location: Norway - Oslo
Going for the download to explore a bit now.
Will keep you posted but have the feeling that this knowledge exists somewhere in the community already.

Though I have the feeling that I need to go for a more hacking solution like exposing some web services from a user control as a macro in Umbraco, and the consume them outside. Might be the best and a good loosely coupled solution. :-)

Thanks.

Stian

Want easy Ajax in Umbraco?
Download and test with Gaia Ajax - http://gaiaware.net
Open Source
Dirk
Posted: Saturday, August 16, 2008 12:48:51 PM

Rank: Addict

Joined: 9/27/2007
Posts: 977
Location: Belgium
Now that you mention it. Have a look at the webservices already available. Might already be exactly what you're looking for. Funny I didn't think of this before.

Regards,
/Dirk


level 1 certified - umbraco blog at netaddicts.be - working on an integrated forum4umbraco
Dirk
Posted: Saturday, August 16, 2008 12:49:33 PM

Rank: Addict

Joined: 9/27/2007
Posts: 977
Location: Belgium
All webservices live in the umbraco.webservices assembly.

level 1 certified - umbraco blog at netaddicts.be - working on an integrated forum4umbraco
stiansol
Posted: Monday, August 18, 2008 1:21:02 PM
Rank: Newbie

Joined: 8/16/2008
Posts: 8
Location: Norway - Oslo
Hi,

I've gone for use of the built in web services and have managed to get out documents via the use of web service at /umbraco/webservices/api/DocumentService.asmx. I hope this is the best web service to use. Though I struggle with some issues...

My goal is to use the menu structure from Umbraco on other asp.net web applications outside the Umbraco environment.
The challenge I have now is to get the standard url for the document. Inside the umbraco api I'd just have written:

Code:
lnk.NavigateUrl = umbraco.library.NiceUrl(childNode.Id);


This is not possible now, because I am not inside the Umbraco context.

How can I still get the url for the document?
Any ideas?

Regards
Stian



Want easy Ajax in Umbraco?
Download and test with Gaia Ajax - http://gaiaware.net
Open Source
Users browsing this topic
Guest


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.