Thursday, April 28, 2016

Image Slider - SharePoint Picture lilbrary using jquery.bxslider.js

Image Slider - SharePoint Picture lilbrary using jquery.bxslider.js

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>
<script src="/sites/eDMS/Style%20Library/ImageCarousel/jquery.bxslider.js"></script><link href="/sites/eDMS/Style%20Library/ImageCarousel/jquery.bxslider.css" rel="stylesheet" runat="server" />
<script type="text/javascript">
    var clientContext;
    var siteCollection;
    var imgLoc
    var appendString = '';
    var totalSiteCount = 0;
    var siteCount = 0;
    var asyncCallbacks = [];
    var siteCollUrl = '';
    var webHost = '';
    var isIE = false;

    $(document).ready(function () {
        SP.SOD.executeFunc('sp.js', 'SP.ClientContext', function () {
            $("#sliderplaceholder").html('');
            showProperties();
        });
    });

    function showProperties() {
        if (msieversion()) {
            //alert($.browser.version);
            siteCollUrl = _spPageContextInfo.siteAbsoluteUrl + "/";
            webHost = siteCollUrl ;
        }
        else {
            siteCollUrl = _spPageContextInfo.siteAbsoluteUrl;
            webHost = siteCollUrl + "/";
        }

        getWebPartProperties('Local');
    }

    function msieversion(str) {

        var ua = window.navigator.userAgent;
        var msie = ua.indexOf("MSIE ");

        if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./))  // If Internet Explorer, return version number
        {
            //alert(parseInt(ua.substring(msie + 5, ua.indexOf(".", msie))));
            //return true;
            isIE = true;
            return true;
        }
        else  // If another browser, return 0
        {
            //alert('otherbrowser');
        }

        return str;
    }

    function getWebPartProperties(imageLoc) {

        switch (imageLoc) {

            case 'Local':
                clientContext = new SP.ClientContext(_spPageContextInfo.webServerRelativeUrl);
                this.oSite = clientContext.get_site();
                this.oWebsite = this.oSite.get_rootWeb();
                this.list = this.oWebsite.get_lists().getByTitle("AAGBanners");
                var query = "<View><Query><Where><Eq><FieldRef Name='Region' /><Value Type='Choice'>CoastalMarine</Value></Eq></Where></Query><ViewFields><FieldRef Name='BannerLinkURL' /><FieldRef Name='FileRef' /><FieldRef Name='Title' /></ViewFields></View>";
                var camlQuery = new SP.CamlQuery();
                camlQuery.set_viewXml(query);
                this.productcollection = this.list.getItems(camlQuery);

                clientContext.load(this.productcollection, 'Include(BannerLinkURL, Title, FileRef)');
                clientContext.executeQueryAsync(Function.createDelegate(this, function () {
                    var appendString = "<ul class='bxslider'>";
                    console.log('hi');
                    var ListEnumerator = this.productcollection.getEnumerator();

                    while (ListEnumerator.moveNext()) {
                        var currentItem = ListEnumerator.get_current();

                        if (currentItem.get_item('FileRef') != null) {
                            console.log(currentItem.get_item('FileRef'));
                            //alert(currentItem.get_item('ImageURL'));
                            var url = $("<a href='" + currentItem.get_item('FileRef') + "'>").prop("pathname");
                            if (isIE)
                                url = url.substr(1, url.length);
                            appendString += "<li style='position: absolute; top: 0px; z-index: 5; display: block;'><a href='" + currentItem.get_item('BannerLinkURL') + "'><img  src='" + url + "' title='" + currentItem.get_item('Title') + "' width='100%' height='284px' /></a></li>";
                        }
                    }
                    console.log(appendString);
                    appendString += "</ul>"
                    $("#sliderplaceholder").append(appendString);
                    invokeSlider();
                    //alert("Success");
                }), Function.createDelegate(this, function (sender, args) {
                    console.log(args.get_message());
                }));
                break;
        }
    }

    function invokeSlider() {
        /*$('.bxslider').bxSlider({
          captions: true
        });*/
        $('.bxslider').bxSlider({
            mode: 'fade',
            infiniteLoop: true,
            slideWidth: 600,
            auto: true,
            autoStart: true,
            autoDirection: 'next',
            adaptiveHeight: false,
            autoHover: true,
            pause: 3000,
            autoControls: false,
            pager: true,
            pagerType: 'full',
            controls: true,
            captions: true,
            speed: 500
        });
    }
</script>
<div id="sliderplaceholder"></div>

Friday, April 15, 2016

cd workingcopy
svn checkout http://my.repos.com/path/to/trunk
# make your edits
svn switch http://my.repos.com/path/to/branch
svn commit


Tuesday, April 5, 2016

export search results to a excel OOTB

export search results to a excel OOTB


Refinement panel how the modified date is coming up. Can we give a range

Modified date is coming  just like a time period, such as one year ago,  Month ago, Week ago, and Today... we can change an bit on this.

As per analysis,  refinement panel to have date range,  there is no OOTB method to achieve this  requirement.  The refinement panel cannot have the controls. We can create a custom search web part which can take inputs from user and do the search.


Wednesday, March 16, 2016

Custom entity extraction in SharePoint 2013

Create and deploy custom entity extractors in SharePoint Server 2013

  • Create a Search service application
  • Add one or more content sources and run a full crawl
  • Configure a search results page
Follow these two links

https://technet.microsoft.com/en-IN/library/jj219480.aspx

http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2013/01/08/no-metadata-no-problem-custom-
entity-extraction-in-sharepoint-2013.aspx

Thursday, October 1, 2015

Exposing WCF REST Service over BasicAuthentication

<system.serviceModel>
  <behaviors>
      <serviceBehaviors>
        <behavior name="MyServiceServiceBehavior">
          <serviceMetadata httpGetEnabled="false" httpsGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="false" />
        
        </behavior>
     
      </serviceBehaviors>
      <endpointBehaviors>
        <behavior name="jsonBehaviour">
          <webHttp automaticFormatSelectionEnabled="true"/>
        </behavior>
      </endpointBehaviors>
    </behaviors>
<bindings>
    <webHttpBinding>
        <binding name="BasicAuthentication">
            <security mode="TransportCredentialOnly">
                <transport clientCredentialType="Basic" />
            </security>
        </binding>
    </webHttpBinding>
</bindings>
    <services>
      <service name="Cadence.SP.COS.Services.QueryService" behaviorConfiguration="MyServiceServiceBehavior">
       <endpoint address="" bindingConfiguration="BasicAuthentication" binding="webHttpBinding" behaviorConfiguration="jsonBehaviour" contract="Cadence.SP.COS.Services.IQueryService">
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange">
        </endpoint>
      </service>
      </services>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" />

  </system.serviceModel>


Thursday, July 30, 2015

Federating Search


Federating Search
Sometimes you may have too much content outside of SharePoint or maybe you have a system that already has a capable search engine (i.e.: an ERP or another document management system).  This calls for federated search. As another example, you might use a federated search to display results from your public facing web site or from a public search engine like Bing.  You don’t want to completely index their data, but you would still like to see results from those external systems when searching from SharePoint.  The Federated Search feature allows you to display results from any search engine supporting the OpenSearch 1.1 protocol alongside your local search results.  If you are not familiar with OpenSearch, the results come back as an RSS feed.  Even if your external system doesn’t support OpenSearch, you can write some code to refactor the results as RSS and integrate them easily into SharePoint.  Here is an example, where the federated results come from DotNetMafia.com on the right side of the screen.
Exposing SharePoint Search to other applications



Search Reports
The search reports capture the user behavior information related to the queries on the site.
Trend Reports
1.     Number of Queries: Total number of queries each day.
Rank Reports
1.     Top Queries: Most issued queries per day.
2.     Failed Queries: Most issued queries for which either there were no results or the user did not click on any results.
3.     No Result Queries: Most issued queries for which no results were returned.
Other Reports
1.     Best Bet Suggestion Report: Recommends URLs as most likely results for particular search queries based on analysis of usage patterns. The site administrators can accept or reject these suggestions. If they accept, the corresponding query-URL pair is added to the search keywords list.
2.     Best Bet Usage: Shows how Best Bet suggestions are doing over time. For every Best Bet query issued, the report shows the percentage of clicks on the Best Bet URL compared to other URLs.
3.     Best Bet Action History Report: Tracks the actions performed by the site administrator on the ‘Best Bet Suggestion’ Report.
Report Scope
Site
Site Collection
Web Application
Search Service Application
Number of Queries

check[51]
check[53]
check[55]
Top Queries

check[59]

check[57]
Failed Queries

check[61]


No Result Queries



check[63]
Best Bet Usage

check[65]


Best Bet Suggestions

check[67]


Best Bet Suggestion Action History

check[69]



Table 2:  Summary of the search reports availability at different SharePoint component hierarchy levels

Get Search Analytics Reports programmatically in SharePoint 2013

How to get Search Analytics Reports programmatically in SharePoint 2013

Console application

using System;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Administration;
using Microsoft.Office.Server.Search.Administration;
using Microsoft.Office.Server.Search.Analytics;


namespace SharePointConsoleApplication2
{
    class Program
    {
        static void Main(string[] args)
        {
            SPSite site = new SPSite("http://YourseverName/sites/Ptrends/");
            SPUserToken userToken = site.UserToken;

            SPSecurity.RunWithElevatedPrivileges(delegate
            {
                using (SPSite site1 = new SPSite(site.ID, userToken))
                {
                    SPServiceContext context = SPServiceContext.GetContext(site1);
                    SearchServiceApplicationProxy searchProxy = context.GetDefaultProxy(typeof(SearchServiceApplicationProxy)) as SearchServiceApplicationProxy;
                    AnalyticsItemData usageData = searchProxy.GetRollupAnalyticsItemData((int)SearchReportTypeId.TopQuery, Guid.Empty, Guid.Empty, Guid.Empty);

                    int dailyHits = usageData.GetHitCountForDay(DateTime.Today);
                    int monthlyHits = usageData.GetHitCountForMonth(DateTime.Today);
                    Console.WriteLine(String.Format("Report Daily Hits={0}; Monthly Hits={1}", dailyHits, monthlyHits));

                    uint maxRows = 1000;
                    DateTime startDate = new DateTime(2015, 7, 1);
                    var searchResults = searchProxy.GetSearchReport((int)SearchReportTypeId.TopQuery, Guid.Empty, Guid.Empty, startDate.Date, true, maxRows);
                    if (searchResults.Count > 0)
                    {
                        foreach (QueryReportData rptData in searchResults)
                        {
                            int hitsCnt = rptData.Count;
                            string qry = rptData.Query;
                            Guid scope = rptData.Scope;
                            Console.WriteLine(String.Format("Report Count={0}; Query={1}; Scope={2}", hitsCnt, qry, scope.ToString()));
                        }
                    }
                }
            });

        }
    }
}

Friday, July 24, 2015

Configure Outgoing emails in Sharepoint server

To install the SMTP service
  1. Verify that the user account that is performing this procedure is a member of the Administrators group on the front-end web server.
  2. Click Start, point to Administrative Tools, and then click Server Manager.
  3. In Server Manager, click Features.
  4. In Features Summary, click Add Features to open the Add Features Wizard.
  5. On the Select Features page, select SMTP Server.
  6. In the Add Features Wizard dialog box, click Add Required Roll Services, and then click Next.
  7. On the Confirm Installation Selections page, click Install.
  8. On the Installation Results page, ensure that the installation is complete, and then click Close.
To Configure SMTP Server:
1.      Click Start, point to Administrative Tools, and then click Internet Information Services (IIS) 6.0 Manager.
2.      In IIS Manager, expand the server name that contains the SMTP server that you want to configure.
3.      Right-click the SMTP virtual server that you want to configure, and then click Start.
4.      Right-click the SMTP virtual server that you want to configure, and then click Properties.
5.      Go to Access Tab Click on Authentication and Check Anonymous Access than click OK.
6.     

7.       Click On Relay and Choose All Except List Bellow


8.       Click On Delivery Tab, Outbound Security provide Credentials Click On OK
9.       Click on outbound Connections Change port 25 to 587
10.   Click on Advanced and following details
11.   Configure Outgoing mails from CA

How to Deploy Your HTML Website on a Linux Server (Apache + SFTP)

Launching a simple HTML website on your own Linux server is easier than you might think. Whether you're sharing a static landing page or...