Managed Metadata Navigation not showing to users

14. February 2016 20:13 by Mahmoud Farhat in SharePoint 2013  //  Tags:   //   Comments (0)

Once you are created a Managed Metadata service and created group, term-set and terms and setted up navigation to use Managed Navigation (Managed Metadata Service).

you will find this case when you are logged-in as a farm admin then you will be able to view the navigation and when when you browse site as anonymous site. the public users are not seeing navigation.

 

Solution

You have to make sure that simple link or header is selected for the terms 

Access Denied on the site collection after migrating form SharePoint 2010 to SharePoint 2013

24. April 2013 01:55 by Mahmoud Farhat in SharePoint 2013  //  Tags:   //   Comments (0)

Access Denied on the site collection after migrating form SharePoint 2010 to SharePoint 2013.

Problem:

This problem happens if you are using the detach and attached database approach for the migrating SharePoint 2010 to SharePoint 2013 because the old site collection administrator user is already stored in the content database  

Solution:

 

1-      If you connected the same domain you will not see this problem otherwise

2-      Open the Central Administration and under the application management

3-      Select "Change Site Collection Administrator" then you will find the old site collection administrator   

4-      Then change the old site collection administrator with the new one

SharePoint 2013: ExecuteOrDelayUntilScriptLoaded not executing after page publish

23. March 2013 04:29 by Mahmoud Farhat in SharePoint 2013  //  Tags:   //   Comments (0)

In SharePoint Client Object Model and after migration from SharePoint 2010 to SharePoint 2013 your Client Object Model code is running well when the page is Unpublished but once you Published it your Client Object Model Code is not working, don't worry this is not a bug but Microsoft did some changes in the "ExecuteOrDelayUntilScriptLoaded" method in SharePoint 2013 and renamed it to be "executeFunc"

Example:

SharePoint 2013 Code:

SP.SOD.executeFunc('sp.js', 'SP.ClientContext', sharePointReady);

function sharePointReady() {
   alert("Ready");
}

SharePoint 2010 Code:

ExecuteOrDelayUntilScriptLoaded(sharePointReady, "sp.js");

function sharePointReady() {
   alert("Ready");
}

 

References:

http://msdn.microsoft.com/en-us/library/jj245759.aspx

 

SharePoint Error: There are currently no approval tasks assigned to you

Sometimes you get this error "There are currently no approval tasks assigned to you" with SharePoint sites based on "Publishing site with workflow" template and usually your user have the all rights (Full Control) 

Solutions:

1- Make sure that you are using new user with any roles that you want Ex:Full control but it should be different than Farm Administrator (System Account) as we usually do this mistake in our development machine

2- The important part to allow your user to approve your content, it should be to add your User inside the SharePoint Approval Group

Note:

The SharePoint development best practice is you shouldn't use the Farm Administrator in you development machine or testing because this is not real case in production and according to the system account user role, he passed everything

 

Handling custom HTTP error messages on IIS 7 by SharePoint 2010

HTTP errors are returned to the client when something goes wrong on the server. Error status codes are returned if the requested file isn't found (404), or due to coding errors in the web page (500), and due to temporary issues such as failed database connections (500). The most common errors are 404 (file not found) and 500 (application) errors.

Check the following list of IIS errors

  • 400 Error (bad request)
  • 401 Error (unauthorized)
  • 403 Error (forbidden)
  • 404 Error (not found)
  • 500 Error (internal server error)

How to Custom HTTP Errors?

To implement SharePoint support of the custom HTTP error you have to editing in WebConfig file by adding the below section inside <system.webServer> tag and then you can replace "/Pages/404.aspx" with your own dynamic page.

<httpErrors errorMode="Custom" existingResponse="Auto">
     <remove statusCode="404" subStatusCode="-1" />
           <error statusCode="404" prefixLanguageFilePath="" path="/Pages/404.aspx" responseMode="ExecuteURL" />
</httpErrors>

Actually the important part in the above snippet code is in <httpErrors errorMode="Custom" existingResponse="Auto"> because if you are working in SharePoint Config file you have to add to the httpErrors element setting error mode to custom and this will inform IIS to you out custom page.  


Note:

This configuration is just supported in newest versions of IIS starting from IIS7

Attaching Custom Content Types to a list with site definition or Web Template

7. February 2012 00:08 by Mahmoud Farhat in   //  Tags:   //   Comments (0)

Created site definition by using SharePoint 2010 and visual Studio which correctly creates all lists and includes pages instances in Pages Document Library, these pages use the correct custom page layouts which using the custom content types and therefore the page doesn’t work as expected.

Then I opened the Library Settings from Pages Document Library and I didn’t find my custom content Type attached to the Pages Document Library.

 

 

 

So how we can attach Custom Content Types to lists like Pages document library?

We can attach our custom content types by the following steps:

1- Create new Empty Element Item and then write the below  code with your content type ID in the Element.xml file 

<Elements xmlns="http://schemas.microsoft.com/sharepoint/">   
<ContentTypeBinding ContentTypeId="0x010100899F73B9F6814EA8AED9876985F28B46" ListUrl="Pages" /> 
</Elements>

2- Add new feature to the Site Definition project, this feature just contains the new element that is already created with the above code.

3- Add a feature dependency in the onet.xml file

<!-- Binds custom content types to Pages library.-->
<Feature ID="260a85fd-e9db-4e1a-aece-7d1c7caa3196">
</Feature>

    4- Add each page in a module with the content type

<File Url="test.aspx" Type="GhostableInLibrary">
         <Property Name="Title" Value="Test" />
         <Property Name="ContentType" Value="Custom_ContentTypes_Publishing - CustomFive" />
         <Property Name="PublishingPageLayout" Value="~SiteCollection/_catalogs/masterpage/Custo Page.aspx, $Resources:cmscore,PageLayout_WelcomeLinks_Title;" />
</File>

Finally you can deploy your package to the SharePoint and you will find your custom content types attached to the Pages Document Library.

Good luck and I hope this information is helpful to you and Please feel free to write your comment.

Difference between List Definition, List Template and List Instance

25. January 2012 01:04 by Mahmoud Farhat in SharePoint 2010  //  Tags:   //   Comments (0)

 List Definition:

A list definition defines a schema for a SharePoint list. It contains information on what views are being used, which columns and content types are being used, and other metadata information.
 

List Template:

A list template can either be created by end users through the SharePoint user interface using an existing list as a pattern or using an existing list instance. If based on a user-created list it is called a custom list template. A custom list template includes everything that defines the list, including list columns and site columns used by the list, content types used by the list, views defined for the list, and so on.
 

Tips

A list template may sound like a list definition but they are effectively the same thing, a pattern for a SharePoint list. They differ mainly in how they are created:

- A list templates are created in SharePoint or SharePoint designer.
- A list definitions in Visual Studio.


List Instance:

A list instance is an instance of a specific SharePoint list definition or list template. All of its data is stored in the relevant content database. Typically a list in SharePoint used by end users to enter and view data and it is based on either a list template or list definition.


References:
Addison Wesley - SharePoint 2010 Development with Visual Studio 2010

Find Controls in an ASP.NET Page with a MasterPage

5. September 2011 01:07 by Mahmoud Farhat in ASP.NET, C#  //  Tags:   //   Comments (0)

If you are seeking to access control in a master page or aspx page files you have to use FindControl method.

The following code examples shows how to use the FindControl method to get a reference to controls so when using MasterPage file you will find controls rendered with prefix such as “ctl00$<ContentPlaceHolderID>$<NameYouGaveToControl>” according to their place in the page hierarchy so you must get reference to the ContentPlaceHolder first and then use FindControl mehtod to locate the control.

Example:

ContentPlaceHolder mpContentPlaceHolder = 
	(ContentPlaceHolder)Master.FindControl("ContentPlaceHolder1");
if (mpContentPlaceHolder != null)
     Button mpbtnSave = (Button)mpContentPlaceHolder.FindControl("btnSave");

 Gets a reference to a Button control that not in a "ContentPlaceHolder".

Example:

Button mpbtnSave = (Button) Master.FindControl("btnSave");

Gets a reference to a Button control that is in aspx page and not in a MasterPage.

Example:

Button mpbtnSave = (Button) Page.FindControl("btnSave");

Listbox - Change Item's Color

4. September 2011 15:32 by Mahmoud Farhat in ASP.NET, C#  //  Tags:   //   Comments (0)

If you have two collection lists one of them for parent (Main Category) and other one for child (Sub Category) and you want to display both of them in one listbox but you want the parent item take back color different than the child, the below example code is showing how to do this.  
 
//loop for parent collection list
foreach (var parentItem in objParentCollectionList)
{
   //Set all back color items with blue
   listBox1.BackColor = Color.Blue;
   //inset parent items in listbox control
   listBox1.Items.Add(new ListItem(mainItem.Name, mainItem.ID.ToString()));
 
   //Get all childs by parent ID
   objChildCollectionList = GetChildList(mainItem.ID);
   if (objChildCollectionList != null)
   {
       //loop for child collection list
       foreach (var childItem in objChildCollectionList)
       {
           ListItem listItem = new ListItem(childItem.Name, childItem.ID.ToString());
           //change back color foe each child item
           listItem.Attributes.Add("style""background-color: Azure");
           //inset child items in listbox control
           listBox1.Items.Add(listItem);
        }
    }
}
 
Note:
listbox1.BackColor = Color.Blue; it will effect on all listbox items not on specific item

Changing Master Page for SharePoint 2010 Blog Site

I created a blog site in SP2010 and I faced some problems and I will explain them step by step with each solution, after blog site created then from the Site Actions => Site settings, I didn’t find the master page feature enabled to change the custom development master page so you having to enable publishing features to be able to do this through the UI.
 
 
 
 
 
 
 
 









 
 
 
 
 
After applying the custom master page to change, the new master page did not render on the blog site.
  
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
And according to Microsoft Support (http://support.microsoft.com/kb/936908) this just happen if you using a template other than one of the templates on the Publishing tab of the New SharePoint Site page, and they suggested work around on this issue, to use system master to apply the custom master page and actually I don’t know if this is a bug in Microsoft or not but if you compelled you have to use this solution till now.
 
Good luck and I hope this information is helpful to you and please feel free to write your comment.