SharePoint (2003 thru Online)

Monday, September 28, 2015

Website Restore Error

Recently, I was trying to browse a website with IE 10, which also uses Java. Noticed the "Website Restore error" (as shown below).


When i tried to browse the same site with IE 10 (No Add-ons) [You will see the IE 10 (No Add-ons) under Accessories >> System Tools], it was fine but saw a warning message.

The browser's Java plugin is not enabled. This Site uses java for certain file operations.

Worked on to identify the add-on which causes the "Website Restore error".
Finally found that the new Java add-on was causing the issue.


Disabled the 'Java Plug-in 11.51.2' and browsed the web site. Now it is working fine.

Monday, September 21, 2015

How to get latest InfoPath Template

Many SharePoint Developers work on InfoPath templates and publish from their computer/laptop. While they leave the company,if we forget to get the copies, it will be difficult to make further modifications.

We found a way to extract the latest template from the Form Library.

Go to the Form Library Settings >> Advanced Settings, you will see the URL of the Template. You can click on Edit Template and continue modifying.


Otherwise, you can save the Template to your desktop and start working on it.
Add the Template URL to the site URL to save the Template to your Desktop.

http://spdev.com/test/InfopathLibrary/Forms/template.xsn


You can also use SharePoint Designer to get the latest template.

Open Site in SharePoint Designer. Go to Form Library >> Forms Folder. You will find the template.xsn. Get a copy and use it to update new modifications.

Monday, July 20, 2015

SharePoint Search functionality

Sometimes, SharePoint Search functionality doesn't work due to issues like error in Propagation Status in Search Administration such as query Server not responding.

Click  on the below link for solution.
http://venugopalareddy.blogspot.com/2014/10/query-server-is-not-responding-and.html


Also we need to clear the config cache on all servers.

This is a summary of the actions:

  • Stop the “SharePoint 2010 Timer” service.

  • There are loads of XML files that can be found in the folder "C:\ProgramData\Microsoft\SharePoint\Config\". Note there seems to  be folder(s) under Config which has a GUID. 

  • Do not delete the folder(s) with GUID. 
  • Delete all the XML files in the GUID folder. 
  • Do not delete 'cache.ini' file.



  • Edit the "cache.ini" file, setting the content to "1" (without the double-quotes). This indicates that all cache settings need to be refreshed. Eventually this value gets automatically updated to another number when the cache is repopulated.
  • Start the “SharePoint 2010 Timer” service.
We need to perform the above steps on Index, Search, WFE(s) and App(s) servers in order.

Based on your SharePoint Usage, it is better to do this activity every 6 months.

For SP 2010 and 2013 >> https://spcachecleaner.codeplex.com/

List of All DBs in MOSS 2007

Tried to find list of DB’s used by SharePoint. We used to go searching the Central Admin - Application Management - Content Databases option and note all the databases against the URLs.

1. Found an awesome option, navigating to Central Admin >> Operations >> Perform a Backup




2. You can also run the following script on "SharePoint_Config" and get the list. Change the DatabaseInstance and DatabaseServer in the below script with your details.

SELECT o.[Name] AS 'SharePoint_Config',
    Instance.[Name] AS 'DatabaseInstance',
    [Server].[Name] AS 'DatabaseServer'
FROM Objects AS o
    INNER JOIN classes c on c.id = o.classid     
    LEFT JOIN Objects AS Instance ON o.ParentId = Instance.Id
    LEFT JOIN [Objects] AS [Server] ON Instance.ParentId = [Server].Id
    WHERE c.Fullname LIKE '%Administration.SPConfigurationDatabase%'
    OR c.Fullname LIKE '%Administration.SPContentDatabase%'
    OR c.Fullname LIKE '%Administration.SharedDatabase%'
    OR c.Fullname LIKE '%Administration.SearchSharedDatabase%'
    OR c.Fullname LIKE '%Administration.SPSearchDatabase%'


Wednesday, July 8, 2015

No Web Part Zones in SP 2010

We actually don't see Web part Zones in SharePoint 2010. 
We can add the web parts and changing the Layout of the Page.

Edit the Home Page, change the Layout with "Text Layout".


Keep the cursor in the Layout you need and click on 'Insert' tab.



Click on "Web Part" to see and add the Web Parts.

Wednesday, June 10, 2015

How to display RSS feed using XML Web Part


A good solution to display RSS Feeds using XML Web part, so there was no need for some third-party Web Parts. Also there was no need to write any additional code.
Easy step-by-step guide. 
  1. Go to page you need to add the RSS Feed, Open this page in edit view and add new Web Part called XML Web Part. 
     
  2. If Web Part is added to page then open it’s settings window. 
     
  3. On the field XML Link insert your blog feed URL. Check out if link is correct and content is receivable by clicking the link titled as Test Link. 
     
  4. Push button titled as [XSL Editor]. 
     
  5. XSL editing window is opened and now insert XSL code given below. When inserted click [OK]. 
     
  6. You should see the RSS feed as bulleted list. 
     
  7. Save the edited page.
XSL you need is here. Take it using copy and paste.

With the below code, you will get limited items 5 with Published Date in Green color.
<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet version="1.0" 
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" exclude-result-prefixes="xsl"> 
<xsl:output method="xml" omit-xml-declaration="yes" indent="yes"/>
<!--venugopalreddy.india@gmail.com-->

<xsl:template match="/"> 
<div><xsl:apply-templates select="rss/channel"/></div> 
</xsl:template> <xsl:template match="rss/channel"> 
<xsl:variable name="link" select="link"/> 
<xsl:variable name="description" select="description"/> 
<xsl:variable name="pubDate" select="pubDate"/> 

<ul> 
<!--<xsl:apply-templates select="item"/>--><!--For All Items--> 
<xsl:apply-templates select="item[position() &lt;= 5]"/><!--Limit 5 Items--> 
<xsl:apply-templates select="pubDate"/><!-- Published Date of the Items--> 
</ul>
</xsl:template> 

<xsl:template match="item"> 
<xsl:variable name="item_link" select="link"/> 
<xsl:variable name="item_title" select="description"/> 
<xsl:variable name="item_pubDate" select="pubDate"/>

<li> 
<a href="{$item_link}" title="{$item_title}" target="_blank"> 
<b><xsl:value-of select="title"/>&#160;</b> 
<!-- <font color="green"><xsl:value-of select="pubDate"/></font>--><!-- Date and Time --> 
<font color="green"><xsl:value-of select="substring(pubDate,1,16)"/></font> <!-- Date Only --> 
</a>
</li>
<li></li>
</xsl:template> </xsl:stylesheet>




Change the color of a Web Part Column


We need to place the below code in the CEWP in the page where we have the Source Web Part we want to make the column change.

Here is the sample Code: 

 <script type="text/javascript" language="javascript">
  var x = document.getElementsByTagName("TD") // find all of the TDs
  var i=0;
  for (i=0;i<x.length;i++)
  {

    if (x[i].className=="ms-vb2") //find the TDs styled for lists
    {

      //repeat the above for each data value

      if (x[i].innerHTML=="On track")
      {
     // x[i].parentNode.style.backgroundColor='lightblue'; // set the background color of row
        x[i].style.backgroundColor='blue'; // set the background color of cell
        x[i].style.Color='white'; // set font the color
        x[i].style.fontWeight='bold'; // set font to bold
      }

      if (x[i].innerHTML=="Requires attention")
      {
     // x[i].parentNode.style.backgroundColor='orange'; // set the background color of row
        x[i].style.backgroundColor='orange'; // set the background color of cell
        x[i].style.Color='white'; // set font the color
        x[i].style.fontWeight='bold'; // set font to bold
      }

      if (x[i].innerHTML=="Behind schedule")
      {
     // x[i].parentNode.style.backgroundColor='red'; // set the background color of row
        x[i].style.backgroundColor='red'; // set the background color of cell
        x[i].style.Color='white'; // set font the color
        x[i].style.fontWeight='bold'; // set font to bold
      }
    }
  }
</script>

Code Notes:

x[i] is one of the table cells (TD) 
x[i].innerHTML is the contents of a cell (TD) (which may include additional HTML) 
x[i].parentNode is the row containing the cell (a TR) 
x[i].parentNode.style.stylename is used to set any valid style on the TR

Monday, June 8, 2015

How to increase the font size of Web Parts Content



Increase the font size of Web Part Title, Body and colors.

------------------Content Editor Web Part---Title + Body---------------------
<style type="text/css">
.ms-WPTitle {font-size: 16px; font-weight: Bold; color: #354260;}
.ms-summarycustombody a {font-size: 14px;}
</style>

----------------------------Announcement Web Part Title-----------------------
<style type="text/css">
ms-announcementtitle {font-size: 14px; font-weight: bold;}
</style>

---------------------Content Editor Web Part  - Font + Color-------------------
<style type="text/css">
.ms-WPTitle {font-weight: bold; font-family: verdana, arial, helvetica, sans-serif;
color: #003399;
padding-left: 6px;
padding-right: 7px;
padding-top: 2px;
padding-bottom: 2px;
font-size: 8pt;
}

.ms-WPTitle A:link, .ms-WPTitle A:visited
{
color:#003399;
text-decoration:none;
cursor:hand;
}

.ms-WPTitle A:hover
{
color:red;
text-decoration:underline;
cursor:hand;
}

.ms-toolbar {
font-family: verdana;
font-size: .68em;
text-decoration: none;

color: #003399;
</style>
------------------------------------------------------

Add the Above code in the CEWP [Content Editor Web Part].

Friday, May 22, 2015

Recover Lost Service Account Passwords from SHAREPOINT 2010

( We can only recover passwords for Service accounts used to run App Pools )

Somehow we missed to get few Service Accounts passwords while knowledge transfer, when the previous SharePoint Administrator was leaving the company and the guy who created the Service Account forgot to update the Password Vault.

For MOSS 2007, we have tool called SharePoint Documentation Generator where we can retrieve the Identity & Passwords from the Application Pools. As some internal mechanism got changed for new versions, we cannot use this Tool in SP 2010 and 2013.

Luckily, we found a couple of App Pools running with this Service Account.



Ran Windows PowerShell as Administrator and entered the below command, pressed Enter.

cmd.exe /c $env:windir\system32\inetsrv\appcmd.exe list apppool "<Name of the App Pool>" /text:ProcessModel.Password

As shown below.



(^‿^) ... got the password. 

Tried for other service accounts also.

This time updated the Passwords in the Password Vault :)

__________________________________________________________

Finding used accounts on SharePoint 201 Farm.


Service Application Pool accounts
Using the cmdlet
Get-SPServiceApplicationPool
gives you both service application pool name and process account name.
-------------------------------------------
Service Application accounts
To find out what service application pools are used for a given service application use this command:
Get-SPServiceApplication | select -expand applicationpool -EA 0
Note that the -EA = 0 (-ErrorAction SilentlyContinue) will swallow any exceptions due to the fact that not all service applications are web based (inherits from SPIisWebServiceApplication).
-----------------------------------------
Service Instance accounts
The command to get these gets a bit long winded to account for that some are managed and some not:
Get-SPServiceInstance | select -expand service | % { if ( $_.ProcessIdentity -and $_.ProcessIdentity.GetType() -eq "String") { $_.ProcessIdentity } elseif ( $_.ProcessIdentity ) { $_.ProcessIdentity.UserName }}
-----------------------------------------
Services
Using Get-Process does not contain information about what accounts the services are running under. Getting this information would require us to dig a bit deeper.
Fire up PowerShell and type in the following:
Get-WmiObject -Query "select * from win32_service where name LIKE 'SP%v4'" | select name, startname


Other processes ends with "14":
Get-WmiObject -Query "select * from win32_service where name LIKE '%14'" | select name, startname
-----------------------------------------
Object cache accounts
These accounts are used for accessing cached data. Not setting them causes a performance overhead as explained here.
The values are stored in the Web Application properties and can be fetched like this:
Get-SPWebApplication| % {$_.Properties["portalsuperuseraccount"]} 
Get-SPWebApplication| % {$_.Properties["portalsuperreaderaccount"]}

----------------------------------------
Search crawler account 
Setting this account can be done using Set-SPEnterpriseSearchServiceApplication -DefaultContentAccessAccountName, but querying it is a bit tricky:
New-Object Microsoft.Office.Server.Search.Administration.content $(Get-SPEnterpriseSearchServiceApplication) | Select DefaultGatheringAccount

Thursday, May 21, 2015

Event 10009, DistributedCOM


In SharePoint Servers, you see the "DistributedCOM" error with Event 10009.



To Over come the error "DCOM was unable to communicate with the computer ? using any of the configured protocols." as shown below.



Please update the admin accounts you are using for Application on the server in to "Distributed COM Users" group of the server.


After that, you don't see the error anymore.

Friday, April 24, 2015

Add the Web Part (.CAB Solution File)


Add the Web Part (.CAB Solution File)

Follow these steps to deploy your Web Part to Office SharePoint Server 2007.


Make sure you are logged into the server with the service account which has permissions to install the web parts.


For ease of deployment, copy the GoogleSearch.cab file to the following location, where Office SharePoint Server 2007 is installed:

C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\bin

This should be the same as the location of Stsadm.exe. Ensure that you update the path on your computer if it does not match the default location.


Click Start, click Run, and then type cmd /admin.


Type cd "C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\bin"


Run the following command to deploy your Web Part:

stsadm -o addwppack -filename GoogleSearch.cab -url http://localhost -globalinstall -force

After the command returns with "Operation completed successfully," run the following command:


iisreset /timeout:0


Go to Solution Management, Deploy the solution to required Web Application.
Activate the feature from the Site Actions >> Site Collection Features
____________________________________________________________

Add, Deploy & Activate the Web Part (.wsp Solution File)

stsadm -o addsolution -filename SharePointVideoPlayer.wsp


stsadm -o deploysolution -name SharePointVideoPlayer.wsp -immediate 
-allowgacdeployment -url "[Site Collection URL]"

stsadm -o activatefeature -name SharePointVideoPlayerfeature -url "[Site Collection URL]" –force

Add Web Part Zones to default.aspx


Open the default.aspx page in edit mode, from inside the SharePoint Designer. (You may need to open the "Design" tab in SharePoint Designer.)


Select the lower row of the table.

Then, from the "Table" menu in SharePoint Designer, select "Insert" and then "Row Below".


Click into the row you just created. Add a table with 1 row and 1 column. You can create more rows or columns if needed. From the "Table" menu, select "Insert Table". Use the default parameters (or you can change if needed).


Insert >> SharePoint Controls >> Web Part Zone. Place the cursor in the right place and insert Web Part Zones.


Add the Web Part Zones to all cells needed.


Save the Page. Exit SharePoint Designer.
 View the Page in 'Edit page' mode from the Browser.




Tuesday, February 17, 2015

Set SharePoint 2007 Web application/Site Colelction into Read Only.




Use the SharePoint interface to set a Web application/Site Collection to read only. This is normally done as a precursor to an upgrade or migration.

Steps
  • Go to “Application Management > Site Collection quotas and locks”
  • Choose the Site Collection to see what the status is
  • Set to read only and set the message the user sees

Thursday, February 5, 2015

Default User login on Domain (Windows 7)

To do it on the PC, run gpedit.msc, browse to 

Computer Configuration >>
     Windows Settings >>
         Security Settings >>
             Local Policies >>
                Security Options
and look for 

'Interactive login: Do not display last user name' and set it to 'disabled'.
'Interactive login: Display user information when the session is locked' and set it to 'User display name only'.




Wednesday, February 4, 2015

Trick to Edit Web Part pages ( NewForm, DispForm & EditForm )


Sometimes we need to edit and add scripts to the NewForm.aspx, DispForm.aspx & EditForm.aspx based on user requirements.


Here we are trying to add the ID field in the NewForm.aspx.

First, append ?ToolPaneView=2 to the URL to switch to edit mode as shown below.

http://spdev.dev.com/Lists/Announcements/NewForm.aspx?ToolPaneView=2


Next, add a hidden Content Editor Web Part (CEWP) to the page

Then add the below script in the source editor of the CEWP, To Hide the fields.

<script language="javascript" type="text/javascript">

_spBodyOnLoadFunctionNames.push("hideFields");


function findacontrol(FieldName) {


   var arr = document.getElementsByTagName("!");    

// get all comments
   for (var i=0;i < arr.length; i++ )
   {
      // now match the field name
      if (arr[i].innerHTML.indexOf(FieldName) > 0)
      {         return arr[i];      }
   }
}

function hideFields() {


   var control = findacontrol("Title");

   control.parentNode.parentNode.style.display="none";
   control = findacontrol("Link");
   control.parentNode.parentNode.style.display="none";
   control = findacontrol("Expiry Date");
   control.parentNode.parentNode.style.display="none";
}
</script>

________________________________________________________

Next, add a hidden Content Editor Web Part (CEWP) to the page

Then add the below script in the source editor of the CEWP, To Display the ID in the first row.

<script type="text/javascript">

// Item ID in DispForm.aspx and EditForm.aspx


function DisplayItemID()

{
var regex = new RegExp("[\\?&]"+"ID"+"=([^&#]*)");
var qs = regex.exec(window.location.href);
var TD1 = document.createElement("TD");
TD1.className = "ms-formlabel";
TD1.innerHTML = "<h3 class='ms-standardheader'>Issue ID</h3>";
var TD2 = document.createElement("TD");
TD2.className = "ms-formbody";
TD2.innerHTML = qs[1];
var IdRow = document.createElement("TR");
IdRow.appendChild(TD1);
IdRow.appendChild(TD2);
var ItemBody = GetSelectedElement(document.getElementById("idAttachmentsRow"),"TABLE").getElementsByTagName("TBODY")[0];

// To display the ID in the first row
ItemBody.insertBefore(IdRow,ItemBody.firstChild);

// To display the ID in the last row (enable the below line)
//ItemBody.appendChild(IdRow);

}
_spBodyOnLoadFunctionNames.push("DisplayItemID");
</script>

In the above script, you can change the "Issue ID" to any other text as you need.
You need to repeat the above steps to get it on to the EditForm.aspx.