Simple URL Picker - sharepoint

hi my scenario is I want to give the user the ability to browse SharePoint for a file and then the dialog should give me back the URL of that file.
Is this simple? And how to do it?

You can give a try to the AssetUrlSector control from SharePoint.
You can find the MSDN article at
AssetUrlSelector class
Sample code for the control:
<CMS:AssetUrlSelector
ID="assetSelectedImage"
CssTextBox="ms-input ms-assetimagedialog-longtextbox"
UseImageAssetPicker="true"
MaxLength="512"
DecodeUrlPath="false"
AccessibilityName="<%$Resources:cms, asseteditimage_selectedimage_label%>"
runat="server"
AllowExternalUrls="false"
ValidateUrl="true" />
Where CMS is:
<%# Register
TagPrefix="CMS"
Namespace="Microsoft.SharePoint.Publishing.WebControls"
Assembly="Microsoft.SharePoint.Publishing, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
Hope this helps.

Related

SharePoint Link with QueryString Parameters

The task is to migrate classic ASP functionality to SharePoint Server 2013.
On the ASP page, a certain link is visible only if the authenticated user's password can be retrieved from a database. The link looks similar to:
<a target="_blank" href="https://www.someurl.com/secure/login.php?username=<%=strUserName%>&password=<%=rsOpenOrders("CL_password")%>" onmouseover="self.status=' '; return true;">
<img border="0" src="somelogo.gif" width="267" height="80" /></a>
I'm new to SharePoint, and I would appreciate your help (conceptual and code snippet) in solving this problem.
I understand that writing "code behind" is not highly encouraged with SharePoint pages and web parts.
So, what's the best alternative to be able to use the authenticated username value in building the first querystring parameter, and to query a SQLServer database to retrieve the value for the second querystring parameter? Please ignore the security concern here. Thanks!
its called SPSecurityTrimmedControl
example:
<%# Register TagPrefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<SharePoint:SPSecurityTrimmedControl ID="SPSecurityTrimmedControl1" runat="server"
AuthenticationRestrictions="AuthenticatedUsersOnly" Permissions="ManageWeb" PermissionContext="CurrentSite">
<INCLUDE OUR CONTROL / CONTENT HERE>
</SharePoint:SPSecurityTrimmedControl>
I ended up creating custom web parts developed using Visual Studio 2013 for each particular link that needed query string parameters to be built based on values retrieved from database.

Set custom master pages in sharepoint-hosted apps

I want to use custom master pages in SharePoint-Hosted apps.
I followed this article: http://anthony-verschraegen.blogspot.fi/2013/03/sharepoint-2013-apps-custom-app-master.html
But after my solution deployment to site collection (Myportal/sites/apps) i get File Not Found error. How to solve this problem?
Specify your solution structure and URL details will help your question get answer correctly.
Sometime the mismatching, typo in some path will lead you to this error. Within your provided information, I suggest that you should perform the following check:
Check the Module element.xml file: Module Name, File Path, File Url
<Module Name="MasterPage">
<File Path="MasterPage\appNew.master" Url="_catalogs/masterpage/appNew.master" ReplaceContent="TRUE" /></Module>
Check the .aspx file:
Remember the path: "~site/_catalogs/masterpage/"
<%# Page Language="C#" MasterPageFile="~site/_catalogs/masterpage/appNew.master" Inherits="Microsoft.SharePoint.WebPartPages.WebPartPage, Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
Check the package.package file: Does the MasterPage module added to any of your features ?
After make sure the above correct, please let me know if you're still facing this problem.

Adding SocialCommentControl to a page

I have created a page layout for my publishing site. On this page layout i want to add a commenting and rating option.
The rating options shows up just fine on the page but the commentcontrol doesn't seem to be there...
After some research i put the commentcontrol in a webpartzone but this didn't affect the outcome.
Does anyone know what i am doing wrong?
This is my code for adding the commenting part:
<div data-name="WebPartZone">
<!--CS: Start Web Part Zone Snippet-->
<!--SPM:<%#Register Tagprefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"%>-->
<!--MS:<WebPartPages:WebPartZone runat="server" ID="x0e5f5212505f48a9aac43df13eeae4f9" AllowCustomization="True" AllowPersonalization="False" FrameType="TitleBarOnly" LockLayout="True" Orientation="Vertical">-->
<!--MS:<ZoneTemplate>-->
<!--SPM:<%# Register TagPrefix="SharePointPortalControls" Namespace="Microsoft.SharePoint.Portal.WebControls" Assembly="Microsoft.SharePoint.Portal, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>-->
<p>Comment:</p><!--MS:<SharePointPortalControls:SocialCommentControl ID="CommentControl" runat="server"/>-->
<!--ME:</ZoneTemplate>-->
<!--ME:</WebPartPages:WebPartZone>-->
<!--CE: End Web Part Zone Snippet-->
</div>
BTW, i am working in the html file using sharepoint 2013.
thnx
Have you checked your user profile service app in Central Admin? I couldn't even get into it via Central Admin; in the logs I was getting "This User Profile Application's connection is currently not available" So I deleted the service app, recreated, iisreset and presto! All my comment controls magically appeared.

Adding web page to blank sharepoint site definition

I am totally new to Sharepoint (2007) so please bear with me. I would like to automatically create aspx pages when a new site is created. These pages will be linked to through tabs which will be defined by a master page. I do not have a custom site definition and was planning to apply feature stapling to the out of the box blank site definition.
Through my research, I think you can create a web part page and turn this into a feature. I can then staple this to the blank site definition. The problem is I haven't found any information on how to do this. So the two questions I have are:
How do I create a feature that is just an aspx page?
How do I staple this feature to a blank site definition?
I found one person asking the same question here: How to add a web part page to a site definition?
I read the first response but it sort of goes over my head and I don't know if it really answers my question.
Thanks so much!
The answer to your first question depends on whether you mean application pages or content pages. They each have their advantages: application pages are good in that they can run custom server-side code, and content pages are nice because (for example) they can be customized by users, but by default are restricted in what kind of code can be run.
For a pretty good discussion on the differences between the two types in capabilities and restrictions, check out the Windows SharePoint Services SDK and look at the topics called "Application _layouts page type" and "Content page type."
As for stapling, it's pretty easy and more flexible than adding new features to a site definition's onet.xml file. This article seems a pretty good overview of the alternatives. You might want to make a copy of the blank site definition, rename it, and then use that one in your work, though.
Features with content pages
You'll need three types of things for this:
A feature.xml file -- just the boilerplate stuff that refers to the element manifest.
A page template -- this could be the entire aspx page itself, or it could be (for example) a shell of a web part page with WebPartZones defined but no actual web parts (yet).
The element manifest file which refers to your page templates and defines any web parts that should be provisioned as part of activation of your feature.
Your feature's folder structure would look something like this:
12
+-- TEMPLATES
+-- FEATURES
+-- YourFeature
+-- PageTemplates
| +-- Page.aspx (simple aspx page)
| +-- WebPartPage.aspx (still simple, but with WebPartZones)
+-- feature.xml
+-- elements.xml
Feature.xml:
<Feature
Id="CFF117BC-9685-4a7b-88D0-523D9DAD21F0"
Title="Custom Pages Feature"
Scope="Web"
xmlns="http://schemas.microsoft.com/sharepoint/">
<ElementManifests>
<ElementManifest Location="elements.xml"/>
</ElementManifests>
</Feature>
Elements.xml
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<Module Path="PageTemplates" Url="Pages" >
<File Url="Page.aspx" Type="Ghostable" />
<File Url="WebPartPage.aspx" Name="WebPartPage.aspx" Type="Ghostable" >
<AllUsersWebPart WebPartZoneID="Left" WebPartOrder="0">
<![CDATA[
<WebPart xmlns="http://schemas.microsoft.com/WebPart/v2"
xmlns:cewp="http://schemas.microsoft.com/WebPart/v2/ContentEditor">
<Assembly>Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c</Assembly>
<TypeName>Microsoft.SharePoint.WebPartPages.ContentEditorWebPart</TypeName>
<Title>Some content that you want to provision with the feature</Title>
<FrameType>TitleBarOnly</FrameType>
<cewp:Content>
Hello world.
</cewp:Content>
</WebPart>
]]>
</AllUsersWebPart>
</File>
</Module>
</Elements>
Page.aspx
<%# Page MasterPageFile="~masterurl/default.master"
meta:progid="SharePoint.WebPartPage.Document" %>
<asp:Content runat="server" ContentPlaceHolderID="PlaceHolderMain">
Hello World
</asp:Content>
WebPartPage.aspx
<%# Page Language="C#" MasterPageFile="~masterurl/default.master" Inherits="Microsoft.SharePoint.WebPartPages.WebPartPage,Microsoft.SharePoint,Version=12.0.0.0,Culture=neutral,PublicKeyToken=71e9bce111e9429c" meta:progid="SharePoint.WebPartPage.Document" %>
<%# Register Tagprefix="WebPartPages"
Namespace="Microsoft.SharePoint.WebPartPages"
Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<asp:Content ID="main" runat="server" ContentPlaceHolderID="PlaceHolderMain" >
<table width="100%">
<tr>
<td valign="top" style="width:50%">
<WebPartPages:WebPartZone ID="Left" runat="server"
FrameType="TitleBarOnly" Title="Left Web Part Zone" />
</td>
<td valign="top" style="width:50%">
<WebPartPages:WebPartZone ID="Right" runat="server"
FrameType="TitleBarOnly" Title="Right Web Part Zone" />
</td>
</tr>
</table>
</asp:Content>
If you configure your feature in that way, you should be able to deploy site content pages within that structure.
Also, I highly recommend Ted Pattison's Inside Windows SharePoint Services book. It covers this topic in much detail, including the important security aspects of site content pages. It's easily worth the purchase price.

SharePoint : Issue creating Disco

I've followed the instructions here http://msdn.microsoft.com/en-us/library/ms464040.aspx to the letter, when I run disco.exe I get this error:
The HTML document does not contain web service discovery information.
Any suggestions?
http://msdn.microsoft.com/en-us/library/ms464040.aspx
I had some problems with the declaration:
<% # WebService Language="C#" Class="MOSS_WebServices.My_Services, MOSS_WebServices ,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=1b40cb3309a7591b" %>
When you run Disco.exe against your asmx file you may experience very
inconvenient message "HTML document does not contain Web service
discovery information". In my case it was very important to see the exact error message. Please find answer at http://malcan.com/EN/Lists/Tips%20and%20tricks/DispForm.aspx?ID=25

Resources