Answered by:
Deploying data on the host web ?

Question
-
I want to deploy all the JS, CSS, content types , list definitions into my host web. It goes in the app web by default. Can we have it on the host web after the app is deployed.Monday, February 18, 2013 6:49 AM
Answers
-
Hi Sagar,
I think best way is ,create a separate solution so you can deploy the files by creating SharePoint 2013 empty project to your Host web like how you do it in SharePoint 2010.
MCTS,MCPD Sharepoint 2010. My Blog- http://www.sharepoint-journey.com
If a post answers your question, please click "Mark As Answer" on that post and "Vote as Helpful- Edited by Devendra VelegandlaMVP Sunday, February 24, 2013 1:59 AM
- Proposed as answer by Humberto LezamaMicrosoft employee Tuesday, February 26, 2013 10:01 PM
- Marked as answer by star.wars Thursday, February 28, 2013 9:06 AM
Sunday, February 24, 2013 1:59 AM -
Thanks but I still don't understand WHY is that a requirement for your app. Anyway if there are business reasons why you need to do that this thread contains the 2 approaches, you could use a traditional 'solution' for that or you can use an app installation event (remote event receivers) to install items on the host web programmatically. We have a couple of remote receivers samples on http://dev.office.com
Thanks
Program Manager, Office Developer Platform.
- Proposed as answer by Humberto LezamaMicrosoft employee Tuesday, February 26, 2013 10:01 PM
- Marked as answer by star.wars Thursday, February 28, 2013 9:06 AM
Tuesday, February 26, 2013 10:01 PM
All replies
-
You are talking about SharePoint Hosted App ? - AFAIK there is no way to create lists, content types, etc. in the "parent web" instead of the host web during deployment. - May be you can use web services of SharePoint to create structures in the parent web.
For example: For list management use this web service: http://msdn.microsoft.com/en-us/library/websvclists.lists_members.aspx
See this web service for web management: http://msdn.microsoft.com/en-us/library/websvcwebs.webs_members.aspx
HTH
Ingo
Microsoft Certified Master - SharePoint 2010
Monday, February 18, 2013 12:11 PM -
Basically I want my JS , and CSS files to go in document library of the HOST WEB and then I can consume that JS and CSS in my code. I don't want to upload those files manually. I wan them to get uploaded once the app is deployed to the HOST WEB.Monday, February 18, 2013 1:38 PM
-
Please see this node of the SharePoint 2013 SDK (and its child topics) for information about what can be deployed to a host web:
http://msdn.microsoft.com/en-us/library/fp179922.aspx#AccessingApp
The app installation infrastructure will not deploy files to a document library on the host web. However, you can have an InstalledEventEndpoint in which your custom code runs. You could try using this to add files to a document library on the host web. For more information, see this SDK topic:
http://msdn.microsoft.com/en-us/library/fp179933.aspx
Rick - MSFT
Monday, February 18, 2013 11:14 PM -
Technically, yes you could install items on the host web but you would need to do so programmatically. One approach would be to use event receivers and write CSOM code to programmatically deploy things on the host web but that would force you to use a provider-hosted or auto-hosted app.
Could you elaborate more on why you want to follow that pattern though? In general we don't recommend apps to have dependencies like the one you are describing
Program Manager, Office Developer Platform.
Monday, February 18, 2013 11:17 PM -
Hi Humberto,
Thanks for the reply. I want my files to get uploaded in the style library or document library of HOST WEB , then I can use that path in my project to use those files. This is the requirement that I need to meet , can we do it on document.ready ? If yes then can suggest ways.
Thanks !
Tuesday, February 19, 2013 4:14 AM -
Hi Sagar,
I think best way is ,create a separate solution so you can deploy the files by creating SharePoint 2013 empty project to your Host web like how you do it in SharePoint 2010.
MCTS,MCPD Sharepoint 2010. My Blog- http://www.sharepoint-journey.com
If a post answers your question, please click "Mark As Answer" on that post and "Vote as Helpful- Edited by Devendra VelegandlaMVP Sunday, February 24, 2013 1:59 AM
- Proposed as answer by Humberto LezamaMicrosoft employee Tuesday, February 26, 2013 10:01 PM
- Marked as answer by star.wars Thursday, February 28, 2013 9:06 AM
Sunday, February 24, 2013 1:59 AM -
Thanks but I still don't understand WHY is that a requirement for your app. Anyway if there are business reasons why you need to do that this thread contains the 2 approaches, you could use a traditional 'solution' for that or you can use an app installation event (remote event receivers) to install items on the host web programmatically. We have a couple of remote receivers samples on http://dev.office.com
Thanks
Program Manager, Office Developer Platform.
- Proposed as answer by Humberto LezamaMicrosoft employee Tuesday, February 26, 2013 10:01 PM
- Marked as answer by star.wars Thursday, February 28, 2013 9:06 AM
Tuesday, February 26, 2013 10:01 PM -
For anyone else who stumbles across this thread, you can use JSOM (JavaScript Object Model) to provision files from the app site to the host site you are utilizing, which means it is not flagged as a "Full Trust" solution (no CSOM required) and can still be deployed to the MS App Store.
Here is a great, high-level example of how to do this with page layouts in the Master Page Gallery, but the same can be done with the Style Library as well: http://www.youtube.com/watch?v=vo9839rrQsY
Friday, July 5, 2013 2:41 AM -
@justin.
As per my knowledge site management capability are not available in CSOM/JSOM. Are you sure we ca do this?
Amit - Our life is short, so help others to grow.....
Whenever you see a reply and if you think is helpful, click ♥Vote As Helpful♥ And whenever you see a reply being an answer to the question of the thread, click ♥Mark As Answer♥
Friday, July 26, 2013 5:42 PM