August 12, 2012 / Kannan / 0 Comments
There was a requirement to have a search text box and a button in landing page and show OOB search result from a single document library.
After doing some analysis on OOB search the following is the code which we came up with.
The technique is use the query string with query items “k=query”, “cs=This List” & “u=list’s absolute url”. Underlined items are the items which change dynamically.
http://server/sites/site/_layouts/OSSSearchResults.aspx?k=MyQuery&cs=This List&u=http://server/sites/site/MyLibrary
<div>
<script type="text/javascript">
function Search() {
var libraryName = 'Library'; //Library Name
var url = window.location.protocol + "//" + window.location.host + _spPageContextInfo.siteServerRelativeUrl; //http://server/sites/<sitecollection> orhttp://server/sites/<sitecollection>/site
var searchUrl = url + '/_layouts/OSSSearchResults.aspx';
var queryText = document.getElementById('querybox').value;
var queryUrl = searchUrl + '?k=' + queryText + '&cs=This List&u=' + url + '/' + libraryName; //http://server/sites/<sitecollection>/_layouts/OSSSearchResults.aspx?k=<Query from input box>&cs=This List&u=http://server/sites/<site>/<Library Name>
window.navigate(queryUrl);
//alert(queryUrl);
}
</script>
<input id="querybox" name="querybox" />
<input onclick="Search()" name="SearchInLibrary" value="Search In Adapter Document Library" type="button" />
</div>
August 12, 2012 / Kannan / 0 Comments
Recently I was planning to checkout SharePoint 2013 and do a test drive. So to get a virtual machine from our internal cloud hosting I was doing analysis on the hardware requirements for SharePoint 2013 preview and the following came as a shock !
24GB RAM for 2013 preview development server as compared to 4GB for 2010 version.
That’s 6 times of 2010 RAM requirements. I am hoping that the requirements will come down once the SharePoint 2013 goes to RTM.
Hardware requirements—web servers, application servers, and single server installations
Installation Scenario | Deployment type and scale | RAM | Processor | Hard disk space |
Single server with a built-in database or single server that uses SQL Server | Development or evaluation installation of SharePoint Foundation 2013 Preview | 8 GB | 64-bit, 4 cores | 80 GB for system drive |
Single server with a built-in database or single server that uses SQL Server | Development or evaluation installation of SharePoint Server 2013 Preview | 24 GB | 64-bit, 4 cores | 80 GB for system drive |
Web server or application server in a three-tier farm | Pilot, user acceptance test, or production deployment of SharePoint Server 2013 Preview | 12 GB | 64-bit, 4 cores | 80 GB for system drive |
Hardware requirements—database servers
Component | Minimum requirement |
Processor |
- 64-bit, 4 cores for small deployments
- 64-bit, 8 cores for medium deployments
|
RAM |
- 8 GB for small deployments
- 16 GB for medium deployments
For large deployments, see the “Estimate memory requirements” section in Storage and SQL Server capacity planning and configuration (SharePoint Server 2010). These values are larger than those recommended as the minimum values for SQL Server because of the distribution of data that is required for a SharePoint 2013 Preview environment. For more information about SQL Server system requirements, see Hardware and Software Requirements for Installing SQL Server 2008 R2. |
Hard disk | 80 GB for system drive Hard disk space depends on how much content that you have in your deployment. For information about how to estimate the amount of content and other databases for your deployment, see Storage and SQL Server capacity planning and configuration (SharePoint Server 2010). |
Source: http://technet.microsoft.com/en-us/library/cc262485(v=office.15).aspx#hwforwebserver
August 4, 2012 / Kannan / 0 Comments
For one of the SharePoint implementation I was suppose to call the SharePoint 2010 ASMX service within a Custom WCF services hosted in a different server than the SharePoint 2010 host.
So as usual I added the service reference (PS: The add web reference is not available in WCF solution). Then I was getting the following error whenever the ASMX method was hit in the WCF.
"The HTTP request is unauthorized with client authentication scheme ‘Ntlm’. The authentication header received from the server was ‘NTLM’"
After breaking my head for few minutes, decided to hit the Google and got the solution in the source mentioned at the end.
So finally the code which worked is listed below.
EndpointAddress endpoint = new EndpointAddress(new Uri("http://SharePointserver/_vti_bin/InvoiceServices.svc"));
BasicHttpBinding httpBinding = new BasicHttpBinding();
httpBinding.Security.Mode = BasicHttpSecurityMode.TransportCredentialOnly;
httpBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Ntlm;
InvoiceServicesClient myClient = new InvoiceServicesClient(httpBinding, endpoint);
myClient.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Impersonation;
//Invoke the service method here…
Source: http://stackoverflow.com/questions/2608887/sharepoint-web-services-the-http-request-is-unauthorized-with-client-authenti
Note, in the above it might look like half of the link is missing and actually it works.
February 13, 2012 / Kannan / 0 Comments
When I was adding an in-line code into master page I was getting the following error.
An error occurred during the processing of /sites/<collection>/SitePages/Welcome.master. Code blocks are not allowed in this file.
The fix is add the following code to the web.config of the web application which hosts the site collection.
February 13, 2012 / Kannan / 1 Comment
One of the requirements while I was working in SharePoint 2010 was displaying the user name in the master page.
So the following are the 2 pieces of code.
Add the following code to the body tag inside master page. Make sure the below code is outside of any tag which has the runat=”server” property set.
<script type=”text/javascript”>var loginName = “<%= Microsoft.SharePoint.SPContext.Current.Web.CurrentUser.Name %>”;</script>
Now put the following code where ever required.
<span>Welcome, <script type=”text/javascript”>document.write(loginName);</script></span>
If you face the following error…check out the link https://blog.binarybits.net/?p=207
An unexpected error has occurred
If you face the following error…check out the link https://blog.binarybits.net/?p=215
Code blocks are not allowed in this file
If you face the following error… check out the link https://blog.binarybits.net/?p=211
The Controls collection cannot be modified because the control contains code blocks (i.e. <% … %>).
February 13, 2012 / Kannan / 0 Comments
While I was writing an in-line code with javascript inside the master page I was constantly facing the following exception.
The Controls collection cannot be modified because the control contains code blocks (i.e. <% … %>).
Welcome, <script type=”text/javascript”>var loginName = “<%= SPContext.Current.Web.CurrentUser.Name %>”;document.write(loginName);</script>
Found out that the javascript with c# code needs to be out of the tag which has runat=”server”. After checking the code I re-wrote the code into 2 pieces
<script type=”text/javascript”>var loginName = “<%= Microsoft.SharePoint.SPContext.Current.Web.CurrentUser.Name %>”;</script>
The above code I moved out of the “<form runat=”server”…” code and the below code inside the required location.
<span>Welcome, <script type=”text/javascript”>document.write(loginName);</script></span>
Now the page is rendered properly.
February 13, 2012 / Kannan / 1 Comment
While I was modifying SharePoint’s master page to put an inline code, I was constantly redirected to SharePoint Error Page “An unexpected error has occurred”.
After spending nearly an hour to get a clue from EventLog and other sources, I found out that by adding the following config codes to web.config of the web application where the site collection resides, we can see the ASP.NET error page with detailed information.
<SafeMode MaxControls=”200″ CallStack=”true”>
<customErrors mode=”Off”/>