Saturday, February 15, 2014

Map network drive to Offfice 365

If you encounter issues with the mapped drive disconnecting follow these steps

Make sure that you are authenticated to Office 365. To do this, follow these steps:
1. Sign in to the SharePoint Online site by using your Office 365 credentials, and make sure that you click to select the Keep me signed in check box.
2. Open a document library in Explorer View.
3. Try to access the mapped network drive.

If you are authenticated to Office 365 and the issue persists, make sure that an entry for SharePoint is added to the Trusted sites zone in Windows Internet Explorer. To do this, follow these steps:
1. On the Tools menu In Internet Explorer, click Internet options.
2. Click the Security tab, click the Trusted sites zone, and then click Sites.
3. Verify that the following entries are listed in the Websites list:

• https://*.outlook.com
• https://*.sharepoint.com
• https://*.microsoftonline.com
• https://*.lync.com


4 If these entries are not present, add them to the Trusted sites list of websites.
5 Click the Local intranet zone, click Sites, and then click Advanced.
6 Verify that the following entries are listed in the Websites list:

• *.microsoftonline.com
• *.sharepoint.com
• *.outlook.com
• *.lync.com

7 If these entries are not present, add them to the Local intranet zone list of websites.


Tuesday, October 22, 2013

SharePoint Add Calendar Overlay Programmatically

This is sample of code to add calendar overlay pro grammatically:

using (SPSite site = new SPSite("http://sp2013-tarek294:8000/"))
{
     using (SPWeb web = site.OpenWeb())
    {
          web.AllowUnsafeUpdates = true;
          SPList list = web.Lists["Calendar"];
          SPView m_view = list.Views["Calendar"];
          m_view.CalendarSettings = SerializeAccessors();
          m_view.Update();
          web.AllowUnsafeUpdates = false;

    }
}

private static string SerializeAccessors()
{
 return "<AggregationCalendars>
  <AggregationCalendar Id="{56594c0c-5649-458e-a4e3-939589ddc75d}" Type="SharePoint" Name="Holiday" Description="Holiday" Color="5" AlwaysShow="True" CalendarUrl="/Lists/Calendar/Holiday.aspx">
    <Settings WebUrl="http://sp2013-tarek294:8000" ListId="{6913f374-1a4e-4772-8c5f-9f5d56610f71}" ViewId="{0091da5e-e5a4-4e1f-ab96-19f96eeb59fa}" ListFormUrl="/Lists/Calendar/DispForm.aspx" />
  </AggregationCalendar>
  <AggregationCalendar Id="{d65114d1-cb97-41db-a7eb-7cc3614c957e}" Type="SharePoint" Name="Meeting" Description="Meeting" Color="8" AlwaysShow="True" CalendarUrl="/Lists/Calendar/Meeting.aspx">
    <Settings WebUrl="http://sp2013-tarek294:8000" ListId="{6913f374-1a4e-4772-8c5f-9f5d56610f71}" ViewId="{68513c26-b132-4d9e-b9ca-acc74a4cf1dc}" ListFormUrl="/Lists/Calendar/DispForm.aspx" />
  </AggregationCalendar>
  -->
  <AggregationCalendar Id="{cd33c105-6dd4-4cb9-b6ee-ca26dfcdb70e}" Type="SharePoint" Name="TestView" Description="TestView" Color="3" AlwaysShow="True" CalendarUrl="/Lists/Calendar/TestView.aspx">
    <Settings WebUrl="http://sp2013-tarek294:8000" ListId="{6913f374-1a4e-4772-8c5f-9f5d56610f71}" ViewId="{2D81DDC1-A360-4585-BF4A-7C0E512C7AA8}" ListFormUrl="/Lists/Calendar/DispForm.aspx" />
  </AggregationCalendar>
</AggregationCalendars>"
}

SharePoint 2013 Read Overlay setting using javascript



You can use the following the code to retrieve Calendar Overlay settings using Javascript:

EnsureScriptFunc('sp.js', 'SP.ClientContext', function(){
            var clientContext = new SP.ClientContext.get_current();
            if (clientContext != undefined && clientContext != null) {
                 var web = clientContext.get_web();
                                                                                                                               
                 var listCollection = web.get_lists();
                 var list = listCollection.getByTitle("Calendar");
                 var viewCollection = list.get_views();
                 this.view = viewCollection.getByTitle("Calendar");
                 clientContext.load(this.view);
                 clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded),    Function.createDelegate(this, this.onQueryFailed));
}
});
 function onQuerySucceeded() {
        alert(this.view.get_htmlSchemaXml()); //this contains overlays settings
 }
                               
 function onQueryFailed(sender, args) {
       alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
 }

Monday, October 21, 2013

Remove “recent” links from the Left Nav in SharePoint 2013

You can use the following script to master page to remove recent links from Quick launch in SharePoint 2013
jQuery(document).ready(function() {
 jQuery(".ms-core-listMenu-item:contains('Recent')").parent().hide();
});

Friday, October 11, 2013

SharePoint Impersonation mistake

SharePoint API give us function  SPSecurity.RunWithElevatedPrivileges to impersonate by system account users. Some users make mistake in using it by using current site instead of initiate new SPSite.:

SPSecurity.RunWithElevatedPrivileges(() =>
{

using ( SPSite site = SPContext.Current.Site)
{
using (SPWeb web = site.OpenWeb())
{
....................
}
}
}
});

Developer need to use:
SPSite site = new SPSite(SPContext.Current.Site.Url)

instead of:
SPSite site = SPContext.Current.Site

Code will be:
SPSecurity.RunWithElevatedPrivileges(() =>
{

using ( SPSite site = new SPSite(SPContext.Current.Site.Url) )
{
using (SPWeb web = site.OpenWeb())
{
....................
}
}
}
});

Thursday, September 19, 2013

Enable Validator in Email in arabic DisplayName


To Create formula validation for fields in arabic display name you needto replace all commas ',' with semicolons ';'

Check below Email Formula validation  for Arabic field:

=AND(ISERROR(FIND(" ";[البريد الالكترونى];1));IF(ISERROR(FIND("@";[البريد الالكترونى];2));FALSE;AND(ISERROR(FIND("@";[البريد الالكترونى];FIND("@";[البريد

الالكترونى];2)+1));IF(ISERROR(FIND(".";[البريد الالكترونى];FIND("@";[البريد الالكترونى];2)+2));FALSE;FIND(".";[البريد الالكترونى];FIND("@";[البريد الالكترونى];2)+2)
الالكترونى])))))

Safari Browser does not run videos in Asset Library

When used Safari browsers and tried to access videos in asset library, I found black block.
I know Safari supports Html 5 and can run Video tag. After some investigation I found article describe the problem, Safari needs to install quick time to run video using Video tag for more details check Url:

http://eugenekardash.blogspot.com/2012/09/video-in-html5-no-support-in-safari.html