Here’s a fact I have found during my work on a SharePoint add-in with AngularJS, you might have read that ng-show does a similar work as ng-if in case you need to hide or show some markup on your page depending on specific condition, so ng-show and ng-if will both do the work, but with slight difference .. or is it a big difference?
The common thing that’s known about the difference between ng-show and ng-if is that, ng-show and ng-hide both will add the styling to change the display of the element to be “none”, so by changing the css for the element and changing the display property, ng-show will hide or show the element. The difference with ng-if is that it will remove the element itself from the markup if the condition is not met, and will return a clone of this element when the condition is met… But that’s not the only difference as well, and not the important difference..
What caught my attention is a difference that’s related to performance. Imagine you have a table with many rows in your page, with checkbox that’s when checked will view an image related to the row. The thing is, if you’re using ng-show with an expression that evaluates to true/false, all images will always be downloaded in your browser, but you will not see them as they’re going to be hidden because the checkbox is not checked yet. However, when you use ng-if and it evaluates to false by default because the checkbox is not checked, the image will not be downloaded until you check the checkbox, which will be better for browser’s performance (Imagine if you have a repeating section with 100, if you use ng-show, all images will be downloaded to your browser right away, but if you use ng-if, only images that you check will be downloaded).
I hope this helps someone out there with their Angular work as it helped during the Add-in I was working on!
If you worked with Managed Metadata columns in SharePoint, and tried to change the term’s value in the term store you will notice that the value of the new term is not reflected in your lists, this is a common problem with Managed Metadata, but not a problem at the same time.
The reason for this is, the terms used by the site collection are stored in a hidden list inside the site collection, it’s similar to the list used by variation to synchronize between source sites and target sites when using variation in SharePoint.
All what we have to do in this case is to call the method SyncHiddenList,
public static void SyncHiddenList(SPSite site)
As you see from the definition, we need to pass a parameter of our current site collection, and once it’s called, it will update all of your terms inside lists and libraries.
One of the frustrating problems that you might face while developing SharePoint applications is some of the errors that you really don’t know how to troubleshoot, or where to start your investigation, one of the errors I had is the following:
Error occurred in deployment step ‘Recycle IIS Application Pool’: Cannot connect to the SharePoint site: << Site Collection URL >>. Make sure that this is a valid URL and the SharePoint site is running on the local computer. If you moved this project to a new computer or if the URL of the SharePoint site has changed since you created the project, update the Site URL property of the project.
For this error, my environment was 1 SharePoint development server connected to separate SQL server, I was assigned as the farm administrator, and the local administrator on the SharePoint server, but the problem is getting this error once you try to deploy using visual studio 2010, the solution here is that the user deploying using visual studio to have db_owner permission on the content database for the web application.
Here is a quick post on how to get all documents from a document set programmatically:
//First getting reference to the list:
SPList myList= web.Lists.TryGetList(“ListName”);
string strquery = “<Where><Eq><FieldRef Name=’Title’/><Value Type=’Text’>” + “DocumentSetName” + “</Value></Eq></Where>”;
SPQuery strcamlquery = new SPQuery();
strcamlquery.Query = strquery;
//getting reference to the document set item inside the list
SPListItem docsetitem = myList.GetItems(camlquery);
//Now to loop through items in the document set
SPQuery itemDocSetQuery = new SPQuery();
itemDocSetQuery.Folder = docsetitem.Folder;
SPListItemCollection items = myList.GetItems(itemDocSetQuery);
That was a quick post, but I am sure this will be helpful to someone out there.
Since the launch of Apptex Add-in for SharePoint, we’ve seen people who were excited to use it, and we received many comments and “reported bugs” in the initial release that we had to work on. Currently, we are in the process of launching a second release with more features “more templates” and bug fixes.
We appreciate the help of the community who were trying this add-in in their projects, and who got back to us with suggestions and compliments, and now.. we’re glad to announce the launch of SPApptex.com which will be the hub for all the modifications and new features we’ll have, plus more add-ins to come 😉
Remember, this add-in is free to use, and dedicated to the community, so feel free to download your copy and try it out.
An Error you may face is when you try to run a simple SharePoint Management Shell Command, it gives you an error saying :
The HTTP service located at http://localhost:(portNumber)/securitytokenserviceApplication/securitytoken.svc is too busy.
And no commands were working at all.
In this case check the Application Pool for the SecurityTokenServiceApplicationPool, you’ll notice it’s stopped, start it and try again.
If you used RSS feeds with SharePoint, and want to make a button where it will display an RSS for specific pages library, you will notice that title in the RSS will open the properties page for the page, not the page itself, so how to change the option?
Go to your “Pages” library, and click library settings in the ribbon, click on RSS settings, you will see a category called “Document options”, change the “Link RSS items directly to their files?” to yes
After changing this option, you’ll see the expected results.
When you first install SharePoint and open Central Administration for the first time, you’ll be given two choices, either to run the configuration wizard and let SharePoint do the administrative tasks for you, or configure the farm yourself.
If you configure the farm yourself and decided to add the Managed Metadata Service, you would simply go to Application Management>> Manage Service Applications>> Click new and choose managed metadata service. The SharePoint will create the Service Application for you. So if you try to click on the Managed Metadata Service Application you will be presented with the following error:
The Managed Metadata Service or Connection is currently not available. The Application Pool or Managed Metadata Web Service may not have been started. Please Contact your Administrator.
To Solve this issue, go to Central Administration >> System Settings Tab>> Manage Services on server>> and notice the managed metadata web service, its not started by default. click start and go back to your service applications page and view your service application. Note you may need to wait fora minute so that the error will disappear and you can use the service application.
For the custom list you have the ID= idHomePageNewItem, for document libraries it is = idHomePageNewDocument, you can know the exact ID using the IE developer tool or the Firebug in Firefox.
document.getElementById(‘idHomePageNewItem’).innerText= “my new text”;
I was trying to install SP Foundation on my Hyper-V machine, and I faced this problem:
After searching and searching online, some people mentioned activating services and trying to run the configuration wizard again, others mentioned navigating to Microsoft Office Servers folder, which doesn’t exist anymore in the RTM release of SP Foundation, but the same principle works for the RTM. All you need to do is to navigate to the following path:
c:Program FilesWindows SharePoint Services15.0Data, and you’ll find an Analytics folder with a GUIC appended to it. All you need is to share this folder.
Hope this helps someone out there as it took a while for me to resolve.