I'm trying to write a service that will create a new document in the node tree.
The service is monitoring an email account and when a new email comes in it should grab the attachment which will be a pdf and then upload the attachment in to a document type called Service Bulletins.
I found this code below that looks like it will get me started, but what I need to figure out is how I can configure my application to point to the correct instance of umbraco.
I think one way of doing this is to keep the node creation in umbraco, in a user control, and from the service make an http request to the page on localhost. The code for creating the node is definitely good.
going with a web service that opens a way into the Umbraco app is definitely the way to go as Steen said, and it's quite easy and straightforward too once you get the hang of it.
All I wanted to add is that there are already a couple of web services waiting to be consumed, e.g. the DocumentServices usually found under /umbraco/webservices/api/documentservice.asmx which might already have what you are looking for (you probably need to enable the umbraco web services it in the web.config file).
Basically what i need to do is read a csv.. loop through and add products to categories and update existing products in the content tree as a scheduled task..
unfortunately I'll need to determine what the parent node is based on an id from their system.
Create a new node from a windows service.
I'm trying to write a service that will create a new document in the node tree.
The service is monitoring an email account and when a new email comes in it should grab the attachment which will be a pdf and then upload the attachment in to a document type called Service Bulletins.
I found this code below that looks like it will get me started, but what I need to figure out is how I can configure my application to point to the correct instance of umbraco.
DocumentType dt = DocumentType.GetByAlias("ServiceBulletinFile");
User author = User.GetUser(0);
Document doc = Document.MakeNew(item.Name, dt, author, 1128);
doc.Publish(author);
umbraco.library.UpdateDocumentCache(doc.Id);
Am I going about this the right way? Should I possibly try looking at inserting it directly into the database?
Any help would be greatly appreciated, that can point me in the right direction.
-dw
I think one way of doing this is to keep the node creation in umbraco, in a user control, and from the service make an http request to the page on localhost. The code for creating the node is definitely good.
You can easily make a web-service and move the code to a method on the web-service. Calling a web-service from a windows service is quite easy too.
That way the web app will run as usually, caching will work etc etc.
Hi dw,
going with a web service that opens a way into the Umbraco app is definitely the way to go as Steen said, and it's quite easy and straightforward too once you get the hang of it.
All I wanted to add is that there are already a couple of web services waiting to be consumed, e.g. the DocumentServices usually found under /umbraco/webservices/api/documentservice.asmx which might already have what you are looking for (you probably need to enable the umbraco web services it in the web.config file).
Cheers,
Sascha
The 4.x API pretty much wont work without the HttpContext (particularly around the Document API) so you'll need to use a web service/ etc to do it.
Pardon my ignorance but how would one reference the preexisting umbraco services in VS2010?
Cheers,
Tom
Right Click on references -> Add Web Reference
If you don't have that you can go Add Service Reference -> Advances -> Add Web Reference (under Compatibility)
awesome.. thanks..
Basically what i need to do is read a csv.. loop through and add products to categories and update existing products in the content tree as a scheduled task..
unfortunately I'll need to determine what the parent node is based on an id from their system.
Might have to do multiple web service requests then :/
is working on a reply...