cancel
Showing results for 
Search instead for 
Did you mean: 

Using the Office Add-In Search and customizing it

abirb
Champ in-the-making
Champ in-the-making
I am trying to use the Office Add-In search as a sample and able to customize it according to my requirements. The problem I wanted to set the authentication to 'none' , but it gives an error as  500 error as  'companyhome' is not initialised .

The .desc.xml is something like
<webscript>
  <shortname>CCIL Document Search (Month Wise)</shortname>
  <description>Generate the CCIL Add-In Search page (Month Wise)</description>
  <url>/abc/abcMonthSearch?p={path?}</url>
  <authentication>none</authentication>
  <transaction>required</transaction>
</webscript>

When I make the <authentication> as 'user' it asks for a valid uid /pwd (which is OK , but I do not want that)

And the snippet of .ftl file is something like

<#if args.p?exists><#assign path=args.p><#else><#assign path=""></#if>
<#if args.n?exists><#assign node=args.n><#else><#assign node=companyhome></#if>
<#if args.e?exists><#assign extn=args.e><#else><#assign extn="doc"></#if><#assign extnx=extn+"x">
<#if args.n?exists><#assign nav=args.n><#else><#assign nav=""></#if>

<#if (args.maxresults?exists)><#assign maxResults=args.maxresults><#else><#assign maxResults="5"></#if>
<#if (args.month1?exists)><#assign month1=args.month1><#else><#assign month1=""></#if>
<#if (args.year1?exists)><#assign year1=args.year1><#else><#assign year1="2008"></#if>

<#if (args.catg?exists)><#assign catg=args.catg><#else><#assign catg=""></#if>
<#assign defaultQuery="?p=" + path?url + "&e=" + extn + "&n=" + nav>
<#assign searchCommand="OfficeSearch.runSearch('${url.serviceContext}/abc/abcMonthSearchResults', '${defaultQuery}'" >
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
   <title>CCIL Month wise Search</title>
   
   <link rel="stylesheet" type="text/css" href="${url.context}/css/monthSearch.css" />
<!–[if IE 6]>
   <link rel="stylesheet" type="text/css" href="${url.context}/css/monthSearch_ie6.css" />
<![endif]–>
   <script type="text/javascript" src="${url.context}/scripts/ajax/mootools.v1.11.js"></script>
   <script type="text/javascript" src="${url.context}/scripts/office/office_addin.js"></script>
   <script type="text/javascript" src="${url.context}/scripts/office/abc_monthsearch.js"></script>
                     
   <script type="text/javascript">//<![CDATA[
      OfficeAddin.defaultQuery = '${defaultQuery}';
   //]]></script>
</head>

And the error is something like(if I set the authentication as none) :

500 Description: An error inside the HTTP server which prevented it from fulfilling the request. 
  
Message: Error during processing of the template 'Error on line 2, column 48 in abcMonthSearch.get.html.ftl companyhome is undefined. It cannot be assigned to node'. Please contact your system administrator. 
  
Exception: freemarker.core.InvalidReferenceException - Error on line 2, column 48 in abcLMonthSearch.get.html.ftl companyhome is undefined. It cannot be assigned to node


Any help or Pointers are welcome ..
2 REPLIES 2

mikeh
Star Contributor
Star Contributor
You can't have no authentication and access to the Repository at the same time. Your best option is to use "guest" authentication and then append "guest=true" to the request URL.

Mike

abirb
Champ in-the-making
Champ in-the-making
thanks again Mike, I need to do some testing .. till now its fine with passing it with the URL