Configure the WebPart before add it to a page in the SharePoint 2010 - sharepoint

I have an issue: gather configuration of the WebPart before add it to a page. For instance, the Silverlight Web Part has the same behaviour. It show modal dialog with asking to enter path to .xap file.
The enviroment is SharePoint Foundation/Server 2010.
I hope that you has already solved this problem. Please share you solution, whever is has been solved or not.
Thanks.

Web parts properties and configuration are stored in the web parts .dwp file which is just an xml file.
You can manually setup your web part then export the .dwp file via the web part menu. If you examine it in a text editor you will be able to identify the configuration.
You can then import the pre-configured web parts .dwp file using the Add new web part link (can't give you exact instructions as you didn't specify SharePoint 2007 or 2010) or you can import it into the web part gallery so it will be automatically used with "Add new web part"

Related

Export CEWP as .webpart file

I'm trying to export my Content Editor webpart from SP2013 environment, and I expect output file in .webpart format. Currently I'm getting output file in .dwp format.
Any idea how to get Content Editor webpart in .webpart format?
By default you getting the *.dwp file which basically a XML. Content editor is not behaves like *.webpart. What you can be done is export the file as its and import in the visual studio in a empty module. Deploy it..it will be visible in the web parts section. I hope after then you know what to do.
Following post would be useful: How to add content editor web part to webpart gallery| Export content editor web part (OOTB in SharePoint)
Reference: Export CEWP as .webpart file - Stack Exchange
The briefly answer is just replace the extension .dwp with .webpart, it will work because its just an XML file.
From what I know dwp is the old extension used by SharePoint to export webparts, I'm not sure what situation triggered that change in your environment due to you are using SP 2013, however from my perspective its not that critical because you can use both extensions to upload the webpart to a different location, also you can still see the same XML code if you open the file with a text editor.
You may have other reasons to consider it an imporant issue however you haven't provided too much details about your scenario, I'm just assuming you just want to export and import the CEWP to other page, if this is not the case please provide more details and I will update my answer according to your situation (if possible).

Creating a Custom Content Editor WebPart in SharePoint 2013

I have requirement and need a suggestion from you guys. In the below I will state my requirement.
I have a SharePoint 2013 Publishing Site.
This has custom master pages build using some HTML files and custom page layouts.
The client needs to follow the styles according to the clients style guide. For the master pages and the page layouts the styling was not an issue.
The content needed to be follow the same styles as guided by the clients style guide. So we have used 'Script editor' web part to insert the content. But this has a bad influence only the technically skilled users can insert the content.
But if we use the Content editor web part we do not need to use HTML code to insert the content. But the issue is the default content editor web part does not has the styles that relevant to the clients style guide.
Can we create an our own content editor web part that reflect the clients style guide using Visual studio ?
I hope these information is enough to get an idea.
Thanks and regards,
Chiranthaka
Ok guys! Many thanks for your help. I found several articles regarding creating a custom SharePoint 'Custom Content Editor' web part using Visual Studio 2013 and SharePoint 2013 Enterprise. These artcles are somewhat old but we can use them for our purpose.
I will post the URLs for those articles.
Creating a Custom Web Part Editor in SharePoint 2010
Custom Content Editor Web Part for SharePoint

Add a WebPart to a publishing page layout

I've been trying to figure out a way to add a web part onto a page layout. Whenever I try to add a web part zone or web part via the menus in SharePoint Designer, nothing happens. The web part I selected is highlighted blue, but nothing happens.
I have been trying to add the .webpart code on the .aspx page layout with zero luck.
<WebPartPages:WebPartZone>
<ZoneTemplate>
.webpart code in here!
</ZoneTemplate>
</WebPartPages:WebPartZone>
The above just shows the web part zone, and the ability to add a web part, but doesn't show my web part.
I've tried placing the code outside the Zone Template and the WebPartZone, but I typically just get everything between the property tags displaying as text.
You cannot add the codes to get your webpart embeded on a page , you have to open the page layout in a designer and drop the webpart on that specific area - there may not be anyother work around for this
Regards
Arjun
SharePoint was not updated to support creating the snippet of code to add the WebPart to the Page Layout like it is possible with old fashioned WebParts.
Even when inserted in the Page Layout .html file, it is stripped out when the corresponding .aspx file is generated.
We found a workaround which is far from ideal but works:
Edit your Page Layout as you would normally in HTML
Add a WebPart zone where you would like to see the WebPart
Save the HTML and let SharePoint generate the aspx file
Manually edit the aspx file -- don't use SharePoint Designer, as it will strip out what you added -- with a plain text editor and insert the code from the webpart definition (the XML file)
Save the aspx and when you create a page using the page layout, your SPFx webpart should be there
Note that for the WebParts parameters, it is stored as a JSON structure encoded in HTML. To figure out how to setup default parameters in the inserted WebPart, insert it into a regular page manually and look at what has been generated in the aspx file. Then find the long line that has the encoded JSON structure and copy it back to your edited aspx file.
Finally, never edit/save your page layout HTML file since it ewill then simply override your changes. I would keep a copy of your edited aspx file just in case!
It sounds like you're trying to use a Visual Web Part with SharePoint Online, which you can't do. Web parts for SharePoint Online need to be packaged as a part of a solution.
To deploy a solution to SharePoint Online you need to:
Navigate to the solutions gallery: https://<yourfarmsite>/catalogs/solutions/forms/allitems.aspx
Providing that you are logged in with the correct account and have permissions, this will take you to the solution gallery, where you can upload and activate custom web parts for site.
Click the Solutions Menu
Click Upload Solution
Browse to your custom .wsp file and click OK
After the web part has been uploaded, you can activate it; select the web part and click Activate
Now that the custom web part is uploaded and activated in the Solution Gallery, you can edit the site page that you want to add it to and then add it as per a normal web part.

Deploy a .aspx page to the Sharepoint 2010

I am new to sharepoint and have a scenario
1) I have a aspx page which displays some data from a xml.
2) The data is populated in a table in the aspx page using a code behind .cs file.
3) I use some dll's which I have made to access the data.
Note:- This things are done on my local pc which does not have a sharepoint server installed.
Now my question is
1) I want a way using which I can use this page as a webpart in a sharepoint site.
2) Can you please guide me a by which the compiled dll of the web application can be used as webpart.
Note:- I have access to put files on the server but cannot develop anything on that
You can use the User Control in SharePoint and add it to your site page..
OR
Use Visual Studio and create an empty SharePoint project (deploy as farm solution).
Then, right click project and add mapped layouts folder.
Rename this folder to whatever name you want to appear (this folder will get created on the servers layout folder in the hive) after you deploy the solution.
Add your aspx page and cs into this folder
Then, double click on package.package (its inside package, above layouts folder, under project)--> Advanced --> Add (existing assembly) and add your dll references here.(this will add the dlls under your sites sharepoint web.config.
After deploy, you can access page using: http://sharepointsite/_layouts/foldername/youraspxfilename.aspx
Let us know about the progress.

RSS Viewer web part not selectable in Sharepoint Designer

I want to place the RSS Viewer web part into a page layout I've created.
In the Sharepoint Designer (Sharepoint 2010) using the "Advanced Edit Mode" I tried to add the RSS Viewer web part but I cannot find it in the list. Under "Insert>Web part" I find many other web parts but the one I need is missing, also under "More web parts..." it cannot be found.
The web part is installed (I activated the feature). The web part can manually be added to a page into a web part zone when I don't use the Designer but edit the page directly in the browser but of course this is not what I need as I have to put it in the page layout.
Anyone got an Idea why the web part is not selectable/visible in the list?
As I've learned not all web parts are available in this listing.
The workaround would be to manually add the desired web part to a webpart zone on the page (not in the designer) and then open the page in the designer so that you can copy/paste the web part relevant code to the page layout of your desire.

Resources