Showing posts with label SharePoint 2010. Show all posts
Showing posts with label SharePoint 2010. Show all posts

August 29, 2021

 How to prevent/prohibit the creation of SharePoint 2010 workflows (on-premises)?


In case with in your organisation, if you want to meet the below Constraints (for the SharePoint on-premises env's SPS 2013, 2016, 2019):

  • Want existing SP10WFs to continue to work.
  • Want existing SP13WFs to continue to work.
  • Want the ability to edit/delete existing SP10WFs.
  • Want the ability to create/edit/delete SP13WFs.
  • Want the ability to continue using SharePoint Designer.

Why?

SP10WF is being retired in SPO and need to stop proliferation of SP10WF in preparation for migration to O365.

Then do below from your SharePoint management shell (run as Farm account)

$wa = Get-SPWebApplication https://webAppUrl
$wa.AllowCreateDeclarativeWorkflow = $false
$wa.Update()


then after that once you open SharePoint designer to create new workflow you wont see option to create a new SharePoint 2010 workflow:


hope this helped... :) 

May 29, 2014

Resolving SharePoint Application Authentication Error: Login Failed on Web Front End Server(s)

Problem

If you try to log in to the SharePoint web application (http://site.company.com) using host header on the server itself, your windows credential doesn’t work but you can access the same site from outside. The problem happens when you create a SharePoint web application with a host header (site.company.com) on the SharePoint Server (Server Name: company.com) which is installed on Windows Server 2008. This is a known issue with SharePoint 2007 or SharePoint 2010 on the Windows Server 2008 platform and this problem is happening even with the recent patches.

Solution


I had the same problem before when I put the host header in for my production site and I was unable to login from production server itself. The main reason for this issue is that Windows includes a loopback security check feature that helps prevent reflection attacks on your computer. Therefore, authentication fails if the FQDN or the custom host header that you use does not match the local computer name, as the system blocks the authentication procedure while resolving the host header given to the web application. Additionally, you always get the following prompt even though you put correct username and password.



To proof the previous statement, you have to go to the event viewer. If you check the event viewer logs on the “Security” category, you will see something like the one below under the Audit Failure Keyword

Check event viewer log

  • Click Start, click Run, type eventvwr, and then click OK.
  • Click on Security under Windows Log

Do the following steps to resolve this error by modifying the server’s registry to specify the host name. To specify the host names that are mapped to the loopback address and that can connect to Web sites on your computer, follow these steps:
  • Click Start, click Run, type regedit, and then click OK.
  • In the Registry Editor, locate and then click the following registry key: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\MSV1_0.
  • Right-click MSV1_0, point to New, and then click Multi-String Value.
  • Type BackConnectionHostNames, and then press ENTER.
  • Right-click BackConnectionHostNames, and then click Modify.
  • In the Value data box, type the host name or the host names for the sites that are on the local computer, and then click OK.
  • Exit Registry Editor, and then restart the computer.

The name placeholder is considered a host header. It is an alternative name for the computer on which Reporting Services is installed. You must add the NetBIOS and the Fully Qualified Domain Name (FQDN) for name to the BackConnectionHostNames list that is stored in the Windows registry.

For example, if the name is a Windows computer name, such as contoso, the name can likely also be referenced in FQDN form as contoso.domain.com. You must add both representations to the list in BackConnectionHostNames.

So, The above registry modification must be done for all other SharePoint applications which are using Host Header.

Thanks,
JK


Get SharePoint Farm ConfigDB Name, Version, Farm Account Details.

Hi,

here is the powershell command to get the details of Config DB name, Build Version and Farm account:

Get-SPFarm | select Name, buildversion, @{expression = {$_.Defaultserviceaccount.name};Label="Farm Account"}

Thank,
JK

March 21, 2013

InfoPath Form Library Bulk Updater Tool

Hi,

today i come with my intresting achivement with customer requirement, in our customer portal they have a InfoPath form library. and they require a way to do a bulk update with the already submited forms (instead of opening and updating individual items one by one- actually a painful thing). So here is the solution:


 created a visual webpart, which runs a code on button click and do's the magic (in my scenario, it updated data inside xml & library metadata values).

Here is the code inside my button click:

{
lstItemsProcessed =
new List<string>();
int i = 1;
int j = 0;
try{SPSecurity.RunWithElevatedPrivileges(delegate(){

using (SPSite site = new SPSite(SPContext.Current.Site.Url)){

using (SPWeb web = site.OpenWeb(siteUrl)){
web.AllowUnsafeUpdates =
true;
SPList objFlib = web.Lists[libraryName];
foreach (SPListItem objFitm in objFlib.Items){

try{SPFile objExisitingFile = objFitm.File;
//objExisitingFile.CheckOut();XmlDocument xmlFile = new XmlDocument();xmlFile.Load(objExisitingFile.OpenBinaryStream());

XmlNode xmlRootNode = xmlFile.DocumentElement;
XPathNavigator xmlNav = xmlFile.CreateNavigator();
XmlNamespaceManager nsMgr = new XmlNamespaceManager(xmlFile.NameTable);nsMgr.AddNamespace(
"my", "http://schemas.microsoft.com/office/infopath/2003/myXSD/2011-01-05T09:37:29");
if (txtFindVal.Text.Length > 0 && txtValue.Text.Length > 0){

if (xmlRootNode.SelectSingleNode("//my:" + ddlColumnName.SelectedItem.ToString(), nsMgr).InnerText.Equals(txtFindVal.Text)){
xmlRootNode.SelectSingleNode(
"//my:" + ddlColumnName.SelectedItem.ToString(), nsMgr).InnerText = txtValue.Text;
string strData = xmlFile.OuterXml;
MemoryStream msFile = new MemoryStream(Encoding.UTF8.GetBytes(strData));objExisitingFile.SaveBinary(msFile);

//objExisitingFile.CheckIn("Automated update by BulkUpdator V.1");j++;
lstItemsProcessed.Add(i.ToString() +
": Processed " + objFitm.Name + " at " + DateTime.Now.ToShortDateString());}
}
}

catch (Exception ex){
lstItemsProcessed.Add(i.ToString() +
": Error " + objFitm.Name + " at " + DateTime.Now.ToShortDateString() + " -> " + ex.Message);lblMsg.Text =
@"From Button Click Inner Catch (" + i.ToString() + ")<br/>" + ex.Message;}

finally{
i++;
}
}
web.AllowUnsafeUpdates =
false;web.Close();
}
site.Close();
lblMsg.Text =
"Processed: (" + i.ToString() + ") and Updated : (" + j.ToString() + ") at " + DateTime.Now.ToShortDateString();}
});
}

catch (Exception ex){
lblMsg.Text =
@"From Button Click Upper Catch(" + i.ToString() + ")<br/>" + ex.Message;}
}

Thanks for approach initiation post by Andy Noon


i hope this helps you a lot.

Thanks,
JK

Retrieve your SharePoint Product key from server [2007 / 2010 / 2013]

Hi,

here is the below script which can retrieve your SharePoint product key from the machine, tested in Dev server (SharePoint 2010 version). i hope this may help in some situations for you:


const HKEY_LOCAL_MACHINE = &H80000002
strKeyPath = "SOFTWARE\Microsoft\Office\14.0\Registration\{90140000-110D-0000-1000-0000000FF1CE}"
strValueName = "DigitalProductId"
strComputer = "."
dim iValues()
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _
strComputer & "\root\default:StdRegProv")
oReg.GetBinaryValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,iValues
Dim arrDPID
arrDPID = Array()
For i = 808 to 822
ReDim Preserve arrDPID( UBound(arrDPID) + 1 )
arrDPID( UBound(arrDPID) ) = iValues(i)
Next

Dim arrChars
arrChars = Array("B","C","D","F","G","H","J","K","M","P","Q","R","T","V","W","X","Y","2","3","4","6","7","8","9")

For i = 24 To 0 Step -1
k = 0
For j = 14 To 0 Step -1
k = k * 256 Xor arrDPID(j)
arrDPID(j) = Int(k / 24)
k = k Mod 24
Next
strProductKey = arrChars(k) & strProductKey
If i Mod 5 = 0 And i <> 0 Then strProductKey = "-" & strProductKey
Next
strFinalKey = strProductKey

Set wshShell=CreateObject("wscript.shell")
strPopupMsg = "Your Microsoft SharePoint 2010 Product Key is:" & vbNewLine & vbNewLine & strFinalKey
strPopupTitle = "Product Key"
wshShell.Popup strPopupMsg,,strPopupTitle,vbCancelOnly+vbinformation
wScript.Echo strPopupMsg



save its as sharepointlicense.vbs and run it from command prompt.

Thanks,
JK

Update after Suggesting Salaudeen with his Power Shell script for 2007 & 2010 version SharePoint Farm as below:

PowerShell Script to Recover SharePoint 2007 Product key:
function Get-SP2007ProductKey {   
    $map="BCDFGHJKMPQRTVWXY2346789"
    $value = (get-itemproperty "HKLM:\SOFTWARE\Microsoft\Office\12.0\Registration\{90120000-110D-0000-1000-0000000FF1CE}").digitalproductid[0x34..0x42] 
    $ProductKey = "" 
    for ($i = 24; $i -ge 0; $i--) {
      $r = 0
      for ($j = 14; $j -ge 0; $j--) {
        $r = ($r * 256) -bxor $value[$j]
        $value[$j] = [math]::Floor([double]($r/24))
        $r = $r % 24
      }
      $ProductKey = $map[$r] + $ProductKey
      if (($i % 5) -eq 0 -and $i -ne 0) {
        $ProductKey = "-" + $ProductKey
      }
    }
    $ProductKey
}

#Call the function

Get-SP2007ProductKey

PowerShell Script to Recover SharePoint 2010 Product Key:
function Get-SP2010ProductKey {   
    $map="BCDFGHJKMPQRTVWXY2346789"
    $value = (get-itemproperty "HKLM:\SOFTWARE\Microsoft\Office\14.0\Registration\{90140000-110D-0000-1000-0000000FF1CE}").digitalproductid[0x34..0x42] 
    $ProductKey = "" 
    for ($i = 24; $i -ge 0; $i--) {
      $r = 0
      for ($j = 14; $j -ge 0; $j--) {
        $r = ($r * 256) -bxor $value[$j]
        $value[$j] = [math]::Floor([double]($r/24))
        $r = $r % 24
      }
      $ProductKey = $map[$r] + $ProductKey
      if (($i % 5) -eq 0 -and $i -ne 0) {
        $ProductKey = "-" + $ProductKey
      }
    }
    $ProductKey
}
#Call the function
Get-SP2010ProductKey

Update from Senglory  as a comment to my blog post: 03/01/14 

And here's the code for Sharepoint 2013

function Get-SP2013ProductKey { 
$map="BCDFGHJKMPQRTVWXY2346789" 
$value = (get-itemproperty "HKLM:\SOFTWARE\Microsoft\Office\15.0\Registration\{90150000-110D-0000-1000-0000000FF1CE}").digitalproductid[0x34..0x42] 
$ProductKey = "" 
for ($i = 24; $i -ge 0; $i--) { 
$r = 0 
for ($j = 14; $j -ge 0; $j--) { 
$r = ($r * 256) -bxor $value[$j] 
$value[$j] = [math]::Floor([double]($r/24)) 
$r = $r % 24 

$ProductKey = $map[$r] + $ProductKey 
if (($i % 5) -eq 0 -and $i -ne 0) { 
$ProductKey = "-" + $ProductKey 


$ProductKey

#Call the function
Get-SP2013ProductKey


[And still i haven't tried this as i don't have 2013 version environment, if it works please do reply your confirmation]

February 17, 2012

Hide part of link in global navigation breadcrumb

Hi Friends,

Here the user requirement is to hide top level site URL(link) in the global Navigation breadcrumb in the sub site home page (where user is going to share the site URL with others), and not to hide entire breadcrumb.

Actual snap:
so i proceed to check with the IE Developper tool. and the structure in side DIV for the breadcrumb is as:
<SPAN id="ct100someblablablaID".... >
       <span>
          <a class="anchorclass">ROOT SITE COLLECTION</a>
       </span>
       <span>
          TEXT (>)
       </span>
       <span>
          <a class="anchorclass">SUB SITE COLLECTION</a>
       </span>
       <span>
          TEXT (>)
       </span>
and so on.

so decided to go with JQuery SLECTORS. and the respected script as follows:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>

<script type="text/javascript">
$(document).ready(function() {

$('#ctl00_PlaceHolderGlobalNavigation_PlaceHolderGlobalNavigationSiteMap_GlobalNavigationSiteMap span:nth-child(4)').css({'display':'none'});
$('#ctl00_PlaceHolderGlobalNavigation_PlaceHolderGlobalNavigationSiteMap_GlobalNavigationSiteMap span:nth-child(5)').css({'display':'none'});

});
</script>


so in the script selecting sub span elements with in root element SPAN ID,
$('#ROOT_ELEMENT_ID span:nth-child(4)').css({'display':'none'});
this hides my ">" char & selection child node 5 hides my "ROOT SITE URL".

and resulted O/P :

JQuery saved my life....

Regards,
JK

February 10, 2012

Powershell script to List All Sharepoint Site collections and sub sites

Hi,

i came up with an requirement to gather all the site collections and sites and sub sub sites in our 2007 & 2010 environment. so decided to prepare a poweshell script which can list all site collection and it's sub webs list under the site collection and a Final count. the script as follows:

[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint") > $null
$siteUrl = Read-Host "Enter Site URL"
$rootSite = New-Object Microsoft.SharePoint.SPSite($siteUrl)
$spWebApp = $rootSite.WebApplication
$count = 0
           write-host "Site Collections"
           write-host ""
    foreach ($site in $spWebApp.Sites) {
        $count++
        write-host "Site Collections URL --> -->" $site.URL
           write-host ""
           write-host "SubSites"
           write-host ""
    foreach ($web in $site.AllWebs) {
        $count++
        write-host "SubSite URL --> --> -->" $web.URL 
        write-host ""
    } 
}

write-host "Total Count :" $count

Hope this script help in your requirement too.

Regards,
JK

April 19, 2011

Sharepoint's one of CMS new feature - Avoid Broken Links with SharePoint's Document ID Tool

Hi All,

Today one of user got a problem: She have a document library, which have some attachments(.xls,.doc...). and she is going to refer these attachment URL's in word docs and inside contents as a link to share among the vast users.
Here the problem is:- whenever someone changes/renames the attachment the URL referred at docs/inside contents will break - which is not a Perfect CMS solution [b'cauz we are referring static URL of the Document item from the library] So Microsoft introduced Document ID Tool in Sharepoint 2010 to fulfil this requirement - referring an attachment through Constant ID not through its name. Look at below post [ referred by USER, and she is eager to use/migrate to SP2010 too soon]

In SharePoint 2007 if you rename or move a document then all the existing links to it will be broken. Naturally, this leads to angry users and headaches for IT support and staff in general.
Simply put, it affects productivity, especially if happens often. With SharePoint 2010 this issue is resolved by the introduction of Document ID functionality. Basically, each document gets a unique ID that, regardless of its location, remains the same.
This means that when you move or rename a document this ID will not change. So you end up with a static or permanent link to your documents. You will see later in this tip how this unique ID is used in a special URL to access the document.
Let's see how you can configure and use Document IDs in SharePoint 2010.
1. Browse to your SharePoint site and navigate to the site settings page. Click on the Site Collection Features link located under Site Collection Administration section. Locate the Document ID Service and click Activate.
2. Browse to the Site Settings page and click on the Documents ID Settings link located under Site Collection Administration section as shown below.
3. On the Document ID settings page you can put custom characters in a text box (as shown below) which will be added in the start of Document IDs. If you are using them, make sure they are unique and are not repeated. For the search scope -- which lets you select the search scope that will be used to search for documents based on their IDs -- leave it to default (unless you want to use another scope).
4. You are done, but SharePoint 2010 will start assigning the IDs to the documents once it runs the relevant time jobs. If you look at the figure in step 3, there is text in red mentioning this point.
To get IDs assigned immediately, you have to run the jobs manually and then schedule them with the frequency that suits your needs. To do this, run Document ID assigned job and Document ID enable/disable job, browse to SharePoint Central Administration'Monitoring'Review Job Definitions and click on each of these links (one at a time and click Run Now)
You can also change the schedule of this timer so that it meet your needs, although in the figure above it is set to run after one minute. But this may not be the ideal setting for production environments.
5. Browse to your site collection and upload a document into a document library and verify that the document is assigned with a Document ID. You can view the document properties as shown in the figure below.
Please note that your ID will be different.
6. The document ID field is in the form of URL, if you click on it or see the properties of the link (as shown below) you will notice that document id itself is passed as a query string to a SharePoint page DocIdRedir.aspx.
Now you can pass this link/URL to the users and they can access the document and this link/URL will remain valid even if you rename or move the document.
That's pretty powerful, isn't it? Your IT department and your customers will thank you.