0

Not sure if the title is clear, but what I want to achieve is deploy a Custom Web Part using SharePoint Hosted Apps to SharePoint Online. But I don't want the App to appear in "Site Contents".

I followed tutorials online and was successful in uploading a Custom Web Part I can use.

What I noticed when doing this though, is that when I go to "Site Contents", I see my App there. I don't want it showing there since I don't have any use for it there. Is there a way I can remove it from "Site Contents" or is it recommended? I deleted the default.aspx, but when user tries to access, it shows him 404 not found.

Thank you

1

If you dont plan to use the store to deploy your app you could simply go with a modified built-in webpart that you can export and import in the desired webpartcatalogs. These wont show up in the SiteContents.

We are mostly using the Microsoft.SharePoint.WebPartPages.XmlWebPart since it has a property where we can save persistent settings for our webpart.

You should not add script tags to the html referenced in the webpart since it destroys mds. We are using UserCustomActions to add the JavaScript to the pages. The JavaScript searches the page for instances of out webpart and does the magic. Here's a example:

<?xml version="1.0" encoding="utf-8"?>
<WebPart xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/WebPart/v2">
  <Title>Your WebPart Title</Title>
  <FrameType>None</FrameType>
  <Description>Your WebPart Description</Description>
  <IsIncluded>true</IsIncluded>
  <ZoneID>wpz</ZoneID>
  <PartOrder>1</PartOrder>
  <FrameState>Normal</FrameState>
  <Height />
  <Width />
  <AllowRemove>true</AllowRemove>
  <AllowZoneChange>true</AllowZoneChange>
  <AllowMinimize>true</AllowMinimize>
  <AllowConnect>true</AllowConnect>
  <AllowEdit>true</AllowEdit>
  <AllowHide>true</AllowHide>
  <IsVisible>true</IsVisible>
  <DetailLink />
  <HelpLink />
  <HelpMode>Modeless</HelpMode>
  <Dir>Default</Dir>
  <PartImageSmall />
  <MissingAssembly>Cannot import this Web Part.</MissingAssembly>
  <PartImageLarge>/_layouts/15/images/msxmll.gif</PartImageLarge>
  <IsIncludedFilter />
  <Assembly>Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c</Assembly>
  <TypeName>Microsoft.SharePoint.WebPartPages.XmlWebPart</TypeName>
  <XMLLink xmlns="http://schemas.microsoft.com/WebPart/v2/Xml" />
  <XML xmlns="http://schemas.microsoft.com/WebPart/v2/Xml"><![CDATA[<div class="SOME_CLASS_SO_YOU_CAN_FIND_THIS_VIA_JAVASCRIPT"></div>]]></XML>
  <XSLLink xmlns="http://schemas.microsoft.com/WebPart/v2/Xml" />
  <XSL xmlns="http://schemas.microsoft.com/WebPart/v2/Xml" />
  <PartStorage xmlns="http://schemas.microsoft.com/WebPart/v2/Xml">{"exampleSetting" : "here you can save your settings"}</PartStorage>
</WebPart>

Simply save this with a .dwp extenstion and add it to your webpartcatalog. As i described the intelligence should be placed in a usercustomaction.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.