How to create Sharepoint ONET file - sharepoint

I was trying to find any tool that I can use to create ONET file from the existing SharePoint site. Unfortunately wasn't able to find. Does anybody know anything about that? There should be something besides of manual way to do that... Any MS solutions, third party tools?

As John Saunders is alluding, the simplest approach would be to let SharePoint create it for you. It's not exactly sitting in the site though; you can't just open the site in SharePoint Designer & grab it - but there is a way to get it:
Save the site as a Site Template (with or without content, doesn't matter - but without will be faster/smaller)
Download the STP/WSP from the Site Template (SP2007)/Solutions (SP2010/13) Gallery to your desktop
Change the file extension to .CAB
Use an archive tool (i.e. 7-zip) to unpack the CAB file
Within the unpacked CAB you will see a folder whose name will be the original name of your Site Template + "WebTemplate"
Within that folder will be a sub-folder whose name is just the original name of your Site Template
Within that folder is the ONet.xml file

Related

How to transferring files from SharePoint folder to another SharePoint site

I am sorry if this is not the right place to put this question.
I have some files saved inside a SharePoint folder. Now I need to move them to a SharePoint site from that folder.
When I select the folder and select Move To option, I don't see the site in the list of available locations.
Please note, I am not supposed to take the download-upload approach. I have instructed to use the Move To option only.
By the way, I am using the Modern SharePoint UI.
What is the right way of doing this?
In order to move/copy files in sahrepoint to sharepoint you need to follow to destination else the site will not show to you while you move files.
Follow sharepoint site
Once you follow site, then the destination site will show when you select files to move.
Note: you should have enough permissions to move /Copy files in destination location.

How do I programmatically add pages to a wiki library in Sharepoint?

My first question on stackoverflow, I hope I am following the rules.
Anyhow, as the title suggests, I need to figure out how to programmatically add pages to a wiki library. I set up upwards of 30,000 rows in Excel, VBA'd them into txt files containing html that portray articles, and now they are sitting in a folder with nowhere to go. They need to go into a wiki library on SharePoint, where they will be referenced by users in their articles. Two parts:
On single-file upload, cannot upload aspx files. I upload as txt or html and it goes fine. Then I try to change them to aspx. Illegal.
Cannot upload more than one file at a time. Once I figure out #1, this will be an issue.
I assumed there must be a way to mimic whatever the "wikification" process is for files programmatically. Microsoft's how-to on file uploading requires a Sharepoint Project, which requires VS Professional and running SharePoint locally. Neither of these is practical.
Thank you and godspeed.
You could write a small Powershell Script or Commandline application for example in C# or VB. Copy your files to the server and execute your script/app on the SharePoint server. Connect to your SharePoint like the following:
using Microsoft.SharePoint;
...
SPSite site = new SPSite("mysiteurl");
SPWeb web = site.OpenWeb();
// your code goes here
web.dispose();
site.dispose();
...
Then get the directory programmatically where your files reside.
If this was successful, loop through all files in your folder and upload them programmatically to the WIKI Library.
Sound complex, but if you search for the single topics, you will find a lot of solutions/code out there.
You could also write a Console Application which can connect remotely to the SharePoint Server without the need to be executed on the SharePoint itself. In this case you would need to use the Client Object Model (CSOM).
The Office 365 Patterns and Practices site is a great reference. It has a comprehensive sample for creating wiki pages using CSOM here

Copy Selected File in SharePoint To Local Drive

I am trying to copy a selected from from a SharePoint Document List to the servers local drive. But I can not for the life of me find a way to do this within SharePoint 2010 using C# or JavaScript (preferably C#) anywhere. Is this possible? If it is, can anyone provide some pointers that would get me started in the right direction? Thanks!
You can use custom actions to integrate the functionnality to ribbon (see this article).
Once you have added your custom action in the code you can:
If you know a file server relative URL you can get it from the web
SPFile file = YourWebObject.GetFile("FileServerRelativeUrl");
Ones you have your SPFile object you can save it, using .NET IO library, to a disk using
FileStream fileStreamToSave = YourWebObject.OpenBinaryStream();
Than just save it...
IMPORTANT! - You have to give writ access to the folder where you files will be stored.

Creating a link to a downloadable file in Orchard CMS

I've spent several hours trying to figure this out; hopefully, it's an easy solution and the difficulty is simply because I'm brand new to Orchard CMS and no where near an expert web developer...
I've created a Products Download page and need to insert hyperlinks to files that exist on the file system.
the path to the file (on disk) is : c:\Orchard CMS\Downloads\ProductOne\File1.zip
in the page editor, I insert a hyperlink reference with the following URL: /Downloads/ProductOne/File1.zip
When I hover over the hyperlink, it looks correct: http://localhost:12345/Downloads/ProductOne/File1.zip
However, when I click the link, I receive the following exception:
HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.
Any help would be extremely appreciated!
If you don't want to play with source code and web.config files you should use Orchard Media feature. It allows you to upload files into Orchard filesystem and manage those. Links to files uploaded this way look like http://www.myorchardsite.com/Media/[Media folder path]/YourFile.zip
If you are not an experienced developer, I'd strongly advise you to take this approach. The only drawback is that you'd have to reupload those files into Orchard. But this is not as bad as it looks - you can zip them and upload as a single file (Orchard will take care of unpacking the archive if you check the checkbox below upload field).
You need a web.config file that allows the files to be served. You can use one from one of the content directories that can be found in modules or themes.

SharePoint - Determine the Site Definition used to create a Site Template (.STP)

A SharePoint site template is basically a saved version the differences between a Site Definition and the current state of a site. I've read that Site Templates can only be applied to sites that use the same Site Definition that was used to create the template.
If you have an STP file, how do you determine which Site Definition was used to create the Site Template?
STP files are just ZIP-compressed files. If you rename the extension to *.ZIP you can extract the contents and examine the XML files that will contain the info you are looking for.
I don't have a STP file around so I can't tell you exactly what file to look for but I've done that before and is not that hard to find.
Good luck!
Use these steps to determine what site definition a site template was based on:
Save the .STP site template to a local folder.
Rename it to a .CAB file.
Extract the cab file.
Open the manifest.xml file.
There will be a TemplateID value in the section near the top (e.g. 1)
The TemplateID refers to a site defintion.
Open [12 hive]\TEMPLATE\1033\XML\WEBTEMP.XML.
Find the template name with the ID that corresponds to the TemplateID in the site template manifest file (e.g. )
I'm not sure why, but the site definitions are grouped so that you might not know exactly which site definition was used. For example, Team Site, Blank Site, and Document Workspace all share the same Tempalte ID (1). That should mean that a site template with that ID should be able to be applied to any of those 3 sites.
I have written SharePoint Object Model code list all the sites and the site definition used to create the side. Please see this here:
http://manish-sharepoint.blogspot.com/2009/06/finding-template-used-to-create-sites.html

Resources