If you're looking for a quick and easy solution for being able to evaluate the look and feel of your web applications or SharePoint sites across various mobile devices, the Ripple Emulator add-on for Chrome (created by the folks at tinyHippos) is definitely a great tool to have in your toolbox. Once you activate/enable the add-on against a targeted page of a site, it will allow you to quickly select a target device and instantly view the layout of your page as it would appear on that device.
For SharePoint 2013 device channels, one important note is that the user agent being posted by the emulator doesn't match the device (at least at the time of this writing); therefore, you'll want to specify the channel to use by appending the following line at the end of URL in your browser's address bar:
?DeviceChannel=DeviceUserAgent
An example would be as follows:
http://SPWebApplication/Sites/Site/default.aspx?DeviceChannel=iPhone
Saturday, July 27, 2013
Tuesday, July 2, 2013
Obtain all files contained under folders and subfolders within a SharePoint Document Library
If you are looking for a way to programmatically return all documents of a specific content type located within a given SharePoint Document Library regardless of whether they are contained in folders and subfolders within the given library, I've provided the following sample method that will allow you to do just that:
The key to this code being able to return all documents, including documents contained under folders and subfolders, is that I've set the ViewAttributes property to be Scope="RecursiveAll". Without this particular setting, the query would have only returned items that were located immediately under the SharePoint Document Library and would have skipped any documents contained under folders and subfolders.
private SPListItemCollection GetDocumentsByContentType(SPList docLibrary, string contentTypeName) { SPQuery query = new SPQuery(); query.ViewAttributes = "Scope=\"RecursiveAll\""; SPListItemCollection documents = null; try { query.Query = string.Format("<where><eq><fieldref name="ContentType"><value type="Text">{0}</value></fieldref></eq></where>", contentTypeName); documents = docLibrary.GetItems(query); } catch (Exception ex) { throw ex; } return documents; }
The key to this code being able to return all documents, including documents contained under folders and subfolders, is that I've set the ViewAttributes property to be Scope="RecursiveAll". Without this particular setting, the query would have only returned items that were located immediately under the SharePoint Document Library and would have skipped any documents contained under folders and subfolders.
Tuesday, May 14, 2013
How to prevent an I-Phone App that keeps Location Services enabled from draining your I-Phone's battery
Occasionally, I've run into a few I-Phone apps that have a tendency to drain your I-Phone's battery to a nearly useless state in just a few hours. Most often, this is due to the fact that the app always has Location Services (i.e. GPS) running in the background whether or not you're using the app at the moment. Here are a few quick steps you can follow to save the life of your I-Phone's battery when you're not using the offending app:
- Go to your I-Phone's Home Screen
- Touch the Settings icon
- Scroll down and then touch the General icon
- Scroll down and then touch the Restrictions item
- At this time, you'll be prompted to either (1) enter your Restrictions passcode if you've already enabled Restrictions or (2) set up a Restrictions passcode (if you haven't set one up previously, you will need to do so now)
- Enter your 4-digit Restrictions passcode
- Scroll down to the Privacy section and touch the Location Services item
- Scroll down to the item that represents the offending app and turn the value from 'ON' to 'OFF'
Once you're ready to begin your walk, run, or bike ride, simply follow these steps to re-enable the Location Services for the app:
- Go to your I-Phone's Home Screen
- Touch the Settings icon
- Scroll down and then touch the General icon
- Scroll down and then touch the Restrictions item
- Enter your 4-digit Restrictions passcode
- Scroll down to the Privacy section and touch the Location Services item
- Scroll down to the item that represents the offending app and turn the value from 'OFF' to 'ON'
Once Location Services are re-enabled for this app, it's ready to go.
With that said, the good news is that most app developers will resolve this issue once they're made aware of the situation; therefore, be sure to give them a heads up that you're encountering the problem and you're likely to receive a fix over the next few releases. Anyway, this will provide an interim solution if you have the patience to toggle Location Services for the offending app.
With that said, the good news is that most app developers will resolve this issue once they're made aware of the situation; therefore, be sure to give them a heads up that you're encountering the problem and you're likely to receive a fix over the next few releases. Anyway, this will provide an interim solution if you have the patience to toggle Location Services for the offending app.
Friday, April 12, 2013
Design Manager deployed Page Layout not displaying custom css file
I recently ran into an issue in which I was attempting to reference a custom css page within a Design Manager deployed page layout; however, I couldn't get the custom css page to load on web pages despite the fact that I was prominently referencing the css file in the proper location of the page layout's HTML file. After doing a bit of research, I finally discovered that you also need to add a special attribute to the <link> element called "ms-design-css-conversion" and set the value to "no". Here is an example of what your <link> element will look like in order for the custom css file to load properly:
<link href="MyCustomPageLayoutStyle.css" type="text/css" rel="stylesheet" ms-design-css-conversion="no" />
Also, here is a complete example that also shows you the proper location for referencing you custom css file within your custom page layout's HTML file:
<!--MS:<asp:ContentPlaceHolder id="PlaceHolderAdditionalPageHead" runat="server">--> <!--CS: Start Edit Mode Panel Snippet--> <!--SPM:<%@Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"%>--> <!--SPM:<%@Register Tagprefix="Publishing" Namespace="Microsoft.SharePoint.Publishing.WebControls" Assembly="Microsoft.SharePoint.Publishing, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"%>--> <!--MS:<Publishing:EditModePanel runat="server" id="editmodestyles">--> <!--MS:<SharePoint:CssRegistration name="<% $SPUrl:~sitecollection/Style Library/~language/Themable/Core Styles/editmode15.css %>" After="<% $SPUrl:~sitecollection/Style Library/~language/Themable/Core Styles/pagelayouts15.css %>" runat="server">--> <!--ME:</SharePoint:CssRegistration>--> <!--ME:</Publishing:EditModePanel>--> <!--CE: End Edit Mode Panel Snippet--> <link href="MyCustomPageLayoutStyle.css" type="text/css" rel="stylesheet" ms-design-css-conversion="no" /> <!--ME:</asp:ContentPlaceHolder>-->
Wednesday, March 27, 2013
Programmatically determine if a web-scoped feature has been activated
This may be of limited use, but if you're ever looking for a way to programmatically determine if a web-scoped feature has been activated on a given SharePoint site, here is a quick method you can use to obtain that information:
private bool IsFeatureActivated(Guid siteId, Guid webId, Guid featureId) { bool isFeatureActivated = false; using (SPSite site = new SPSite(siteId)) { using (SPWeb web = site.OpenWeb(webId)) { if (web.Features[featureId] != null) { isFeatureActivated = true; } } } return isFeatureActivated; }
Monday, March 11, 2013
View the XML data behind a Search Core Results Web Part
If you wish to view the raw XML data that is associated with a Search Core Results or People Search Core Results web part, you can do so via the following steps:
- Open IE and navigate to the page that contains the given Core Results web part
- Select Site Actions -> Edit Page
- Click on your web part's menu and select Edit Web Part
- Expand Display Properties and click on the XSL Editor... button
- In the Text Editor window, copy the existing XSL to a temporary location since you'll probably need it again. Here is a possible option for you:
- Hit Ctrl+a to highlight all of the content
- Hit Ctrl+c to save the content
- Open Notepad
- Hit Ctrl+v to past the content to Notepad
- Return to the Text Editor window, hit Ctrl+a, and hit Delete
- Copy and paste the following XSL code into the Text Editor window:
- Click Save
- Click OK
- Return to the parent Search page and enter a valid search parameter
<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/> <xsl:template match="/"> <xmp><xsl:copy-of select="*"/></xmp> </xsl:template> </xsl:stylesheet>
Thursday, March 7, 2013
Assign a Preview image to your custom Page Layouts
There are quite a few good sites out there that provide steps for creating custom page layouts using the new SharePoint 2013 Design Manager, but none of them bring up how you would go about assigning a Preview image to your new custom Page Layouts. This is most likely due to the fact it's pretty simple to do once you know where to look for it. Anyway, these procedures assume that you've already created and deployed your new custom Page Layouts using Design Manager. Here goes...
Add the Preview Images to the Master Page Gallery
Add the Preview Images to the Master Page Gallery
- Using your web browser, open up a link to your Master Page Gallery (i.e. http://SharePointWebApp/_catalogs/masterpage/Forms/AllItems.aspx)
- Double-click on the en-us directory
- Double-click on the Preview Images directory
- Click on the Files tab
- Under the New section, click Upload Document
- Click Browse..., navigate to your first Preview file, and click on it
- Click Open
- Click OK
- For Content Type, select Master Page Preview
- For UI Version, place a check in the 15 checkbox
- Click Save
- Once the image is uploaded, click on the image list item and select Publish a Major Version
- Click OK
- Repeat Steps 5-13 for each Preview Image
NOTE: If you don't publish your files as shown in Steps 12-13, your Preview images will appear as a red X when the user is looking at the locations where the Preview image is viewed
Assign the Preview Images
Verify the Preview Image of a custom Page Layout
- Navigate back to the home page of the Master Page Gallery
- If you used the Design Manager to add your custom Page Layouts, you will click on the .html file associated with your first custom Page Layout and select Edit Properties (that is, if they are still associated with each other which is most likely the case...)
- Locate the Preview Image section
- Enter the URL of the file in the Type the Web address: textbox (i.e. http://SharePointWebApp/_catalogs/masterpage/en-US/Preview%20Images/PreviewImageName.png)
- Enter a user-friendly description in the Type the description: textbox
- Click Save
- Repeat Steps 2-6 to assign the Preview images to their resepctive Page Layouts
Verify the Preview Image of a custom Page Layout
Subscribe to:
Posts (Atom)