puneet's profileAchilles WatchesPhotosBlogListsMore ![]() | Help |
"Some or all identity references could not be translated" in SharePoint
I was configuring my WSS 3.0 installation and was getting this exception logged in the eventviewer on every page refresh and getting a message "Some or all identity references could not be translated". The solution to this problem was "stsadm.exe -o updatefarmcredentials -userlogin -password". Yippee, the central administration came up.
Description: Failed to register SharePoint services. An exception of type System.Security.Principal.IdentityNotMappedException was thrown. Additional exception information: Some or all identity references could not be translated. System.Security.Principal.IdentityNotMappedException: Some or all identity references could not be translated. at System.Security.Principal.NTAccount.Translate(IdentityReferenceCollection sourceAccounts, Type targetType, Boolean forceSuccess) at System.Security.Principal.NTAccount.Translate(Type targetType) at Microsoft.SharePoint.Administration.SPFarm.CurrentUserIsAdministrator() at Microsoft.SharePoint.Administration.SPPersistedObject.Update() at Microsoft.SharePoint.Administration.SPService.Update() at Microsoft.SharePoint.Administration.SPDiagnosticsService.Update() at Microsoft.SharePoint.Administration.SPPersistedObject.Update(Boolean ensure) at Microsoft.SharePoint.PostSetupConfiguration.ServicesTask.InstallServiceInConfigDB(Boolean provisionTheServiceToo, String serviceRegistryKeyName) at Microsoft.SharePoint.PostSetupConfiguration.ServicesTask.InstallServices(Boolean provisionTheServicesToo) at Microsoft.SharePoint.PostSetupConfiguration.ServicesTask.Run() at Microsoft.SharePoint.PostSetupConfiguration.TaskThread.ExecuteTask()
Enjai, Puneet.H MOSS: Configure icons for PDF documents in search resultsTo configure the icons for PDF documents to show up in search results (read more about configuring MOSS search to index PDF documents) or in the default view of the document library, follow the steps below:
1. Copy the .gif file to
SharePoint Server 2007- Drive:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\Template\Images
2. Edit the Docicon.xml file to include the .pdf extension. To do this, follow these steps:
3. Restart the server. Enjai Maadi, Puneet.H MOSS and Searching PDF DocumentsI was trying to configure MOSS search to index PDF documents present in the document libraries. Here are the steps:
1. Download Adobe Reader 8.x from here and install it on the server.
2. Add the filter extension to the File Types crawled:
3. Modify the following registry default values with the new CLSID for the Adobe IFilter:
{E8978DA6-047F-4E3D-9C78-CDBE46041603} (run regedit in the command prompt
4. Add the Installation directory of the Adobe Reader v.8 to the System Path. For example, if the Reader is installed on "D:\Program Files\Adobe", then add "D:\Program Files\Adobe\Reader 8.0\Reader" to the system path by:
Right Click on My Computer -> Properties -> Advanced -> Environment Variables -> Path (Under System Variables) -> Edit -> (Add "D:\Program Files\Adobe\Reader 8.0\Reader").
5. Restart the search service by running the following commands in the prompt:
Enjai Maadi,
Puneet.H MOSS 2007 - Create a survey, add question and choices programmaticallyI was trying to create an out of the box survey programmatically and wanted to add the question and choices to it too. Below is the sample implementation in C#.
SPWeb web = SPControl.GetContextWeb(HttpContext.Current);
// create the out of the box survey using the list template
Guid surveyId = web.Lists.Add("Name of the Title", "Description of the survey", SPListTemplateType.Survey);
SPList survey = web.Lists[surveyId];
string Question = "what?";
StringCollection choices = new StringCollection();
choices.Add("choice1");
choices.Add("choice2");
choices.Add("choice3");
// Set the question and choices for the survey
survey.Fields.Add(Question, SPFieldType.Choice, true, false, choices); // save the changes back to the list
survey.Update();
// save the changes made in the site
web.Update(); Enjai Maadi,
Puneet.H A fast one on new hiresWe just pulled a fast one on the new hires the other day. We welcomed them with pomp and grandeur. We had elephants, drums et all. The video can be seen at http://www.youtube.com/watch?v=9GpPcMVbmtw. You can also watch the video below...
-Enjai Maadi,
Puneet.H
Chart Web part in MOSSFound this link which lets you download a chart web part. You can use it as a bar chart or as a pie chart.
Check it out at ListCharts - new web part.
Enjai Maadi,
Puneet.H Media player in MOSS 2007I needed to stream a video file to the client.. say as in streaming a webcast. So we needed to embed a video player in a SharePoint site. I found this link where he has explained the same. It worked for me like a dream.
Add a Content Editor Web Part onto your page, and click on the Source Editor where you could input the following HTML, and update the URL value accordingly. Parameters could be added or removed according to your needs, refer to w3schools for the parameters available.
<OBJECT id="VIDEO" CLASSID="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" type="application/x-oleobject">
<PARAM NAME="URL" VALUE="/Docs/[Your Document Library]/[folder]/[your file.wmv]"> <PARAM NAME="animationatStart" VALUE="true"> <PARAM NAME="transparentatStart" VALUE="true"> <PARAM NAME="SendPlayStateChangeEvents" VALUE="True"> <PARAM NAME="AutoStart" VALUE="false"> <PARAM name="uiMode" value="full"> </OBJECT> Enjai,
Puneet.H Fourteen Things That It Took Me 50 Years To Learn - Dave Barry1. Never, under any circumstances, take a sleeping pill and a laxative on the same night.
2. If you had to identify, in one word, the reason why the human race has not achieved, and never will achieve, its full potential, that word would be "meetings." 3. There is a very fine line between "hobby" and "mental illness." 4. People who want to share their religious views with you almost never want you to share yours with them. 5. You should not confuse your career with your life. 6. Nobody cares if you can't dance well. Just get up and dance. 7. Never lick a steak knife. 8. The most destructive force in the universe is gossip. 9. You will never find anybody who can give you a clear and compelling reason why we observe daylight savings time. 10. You should never say anything to a woman that even remotely suggests that you think she's pregnant unless you can see an actual baby emerging from her at that moment. 11. There comes a time when you should stop expecting other people to make a big deal about your birthday. That time is age eleven. 12. The one thing that unites all human beings, regardless of age, gender, religion, economic status or ethnic background, is that, deep down inside, we ALL believe that we are above-average drivers. 13. A person who is nice to you, but rude to the waiter, is not a nice person. 14. Your friends love you anyway. Enjai,
Puneet.H Using an Agile Software Process with Offshore DevelopmentI found this blog which highlighted the key lessons
Enjai,
Puneet.H
The Times Of India 14th Feb, 2009This is the funniest of the mails going around on the debacle of the Indian Cricket Team at the World Cup.
---------------------------------------------------------------------------------------------------------------------------
The Times Of India 14th Feb,2009:
India is playing in a 5 nation tournament ;the other countries being Uganda,Sudan,Papua new guinea and the mighty Bolivia.Today is a must win match for India against tournament favourites Bolivia for a berth in the semi finals.The winner of the tournament will fight for a place to enter the top 35 rankings in the world. On the morning of the match ,a strategy session is being held by Greg and Rahul.This is how it goes. Greg:Boys,this is one of the most important matches in the last three years.We have to beat Bolivia.Lets go through the batting line up and the bowling line up in this meeting. Greg:So Sourav ,you will open right? Sourav:I don't know.Bolivia has a pace bowler who only bowls short pitch deliveries.His pace is consistently in the range 55-60 miles /hour.I cannot handle all that pace. Greg:Oh,thats ok.He won't dare to bowl short pitch stuff against the Indian batsman(we have such good credentials).If he does by mistake,just to make a statement to the media,get Hit Wicket and come back.Such non sense should not be tolerated. Greg:So who will partner Sourav. Rahul:I think Sehwag should.He looked in form in the last game against Sudan.He hit 5 fours between first slip and second slip before he caught at second slip.I think he is in the pink of his form and he should open. Greg:Thats good. Greg:Sachin,you will bat at four ... ok? Sachin:I don't know.I have to go shopping at 11.That means I can't bat beyond ten overs. Greg:Sourav and Sehwag will last till six overs.So ,you will come then.Don't worry,just play your natural game and follow your instincts.You will go by ten overs. Greg:So Dhoni,you will keep? Dhoni:I am not keeping.Last time ,I kept for three hours.My hair is getting spoilt of this.I have thousands of lice in my hair.As a result,the cows in my village have started snubbing me and my advances.These days,dragonflies have started staying in my hair as their food lice is there.I need a haircut ,I am not playing. Greg:Please play just one more match,its the mightly Bolivians ,just one last one. Dhoni:Ok.Don't do it next time. Greg meanwhile was going through the batting averages and noticed that Dravid had the longest stay at the crease for the last 67 matches.So he asked Dravid to give a presentation in front of the team as to what motivated him so much and the secret to his concentration. Dravid:My wife is extremely ugly.So,I try to stay as long as possible away from her.That is why I play a low risk game(In the last game,he hit 3 runs from 92 balls) .If I get out,I have to go back to her. Everyone starts applauding .What an inspirational cricketer. Now it is time to decide on the bowling line up. Greg:Obviously Zaheer is opening.He was brilliant last game. (Zaheer had bowled only 23 wides in the last match and he picked up three wickets.The secret to this brilliant bowling performance was a result of a mentoring session from Venkatesh Prasad.Prasad told him that to bowl from mid off and aim at Third slip.As a result ,Zaheer returned with the best figures in the match.) Greg:Offlate I have noticed that Rahul has been facing a lot of pressure and so we have decided to come up with Batting,Bowling and Fielding Captain to relieve Rahul of some of the responsibility. Greg:I have noticed that Munaf Patel has stayed not out in the last three matches(all the other batsmen had got out by then).I admire the commitment of this lad and as a result he is the Batting Captain. Greg:I was also going through this figure.Sourav has been involved in 177 run outs.But he himself has never got out.He values his wicket so much.I think we all need to Congratulate him on the price he sets for his wicket.Sourav,you are the RUNNING BETWEEN THE WICKETS captain. Greg:Anil has been sitting on the bench for the last three years.He keeps taking snaps throughout the match.He is such a teamman.I think we need to recognize this loyalty.Anil,you are the Bowling Captain. Greg:Harbhajan is the fielding captain. Rahul:But he dropped the catch in the last match when he dived to his right to take it. Greg:Atleast he dived in the right direction. After this intense brainstorming session ,India looks all set to take on Bolivia.Please pray for the team's success. --------------------------------------------------------------------------------------------------------------------------------------------------------------------
Enjai,
Puneet.H JavaScript document.write doesnot work in XMLI was working with an XML file which had spit out HTML . This XML file contained a document.write("<script> .... </script>"); which was breaking the xml file.
Enjai,
Puneet.H PKCS7 in .Net and PKCS5Padding in Java with JCEMy Client was encrypting using JCE on a app server running Java 1.3. The padding he was using is PKCS5 padding while in .Net i was using PKCS7 padding mode to decrypt. Both of us were using AES/Rijndael algorithm for encryption and decryption purposes.
I was wondering if the two padding modes were compatible. Yes, they are compatible with each other to block sizes between 1 and 255 bytes inclusive.
For further info go here.
Enjai,
Puneet.H SharePoint - Business Data Catalog walkthroughI was looking out for some BDC related stuff and for some walkthroughs and tutorials.
Here is the MS Virtual Lab link to the walkthrough which i found really helpful. You have to be a MSDN subscriber and a MSN passport account helps.
Also editing the application definition file by hand is a pain. Using BDC MetaMan is advised. You can find it here.
Enjai,
Puneet.H Using SPSecurity.RunWithElevatedPrivileges: Get a FileWell, i had a SharePoint site running Forms Authentication and i had to get a file from the document library for editing. So i decided to give Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges method a try. This takes a void function which will be run in elevated priveleges. So creating/deleting MySite for users while adding them from a legacy system can be done without the application running in System Account.
Heres the sample code:
SPFile rFile;
SPWeb web;
using (SPSite site = new SPSite(serverurl))
{
web = site.OpenWeb();
// get the file
SPSecurity.RunWithElevatedPrivileges(GetSPFile);
// read the file
StreamReader streamReader = new StreamReader(rFile.OpenBinaryStream());
filecontent = streamReader.ReadToEnd();
// do some file manipulation
/*
.......
*/
web.AllowUnsafeUpdates = false;
}
private void GetSPFile()
{
web.AllowUnsafeUpdates = true;
rFile = web.GetFile(strFileURL);
}
Enjai,
Puneet.H C# + Create a CSV Report
Heres the code to create a CSV Report in C#. Here reader is of type SqlDataReader. // Construct a comma-separated list all the column values in the current row
StringBuilder sb = new StringBuilder(); // to hold csv text file
// Create Header and sheet...
string quoter = @""""""; //
{
sb.Append( reader.GetName(j).ToString() ); // headings
sb.Append(","); // delimiter
}
sb.Append("\n");
// build the csv contents
string replVal = String.Empty;
while (reader.Read())
{
for(int k=0;k < reader.FieldCount;k++)
{
if(reader.GetValue(k).ToString()==null)
{
sb.Append("\"" + reader.GetValue(k).ToString() +" " + ",");
}
else
{
string temp = reader.GetValue(k).ToString();
replVal = temp.Replace("\"",quoter);
}
replVal+= " " +",";
sb.Append(replVal);
} //end if
sb.Append("\n"); // new row
} // end while
reader.Close();
reader = null;
SharePoint 2007 + Blocked File TypesIn order to add or remove a file type being added to your SharePoint portal you will have to add/remove the extension of the file from blocked file types. To find out the blocked file types you will have to goto Central Administration -> Operations -> Manage Blocked File Types. You will see a list of extensions. In order to remove a file type, delete the file type and click OK. In order to block a file type, just add it to the list in a new line and click OK. For more information go HERE. SharePoint + HTML EditorWell, if you wanted a HTML editor in your SharePoint application then read on...
SharePoint uses a HTML editor present in http://Server:portno/_layouts/htmledit.aspx for its own purposes.
I have put forth the JavaScript code required to popup the HTML editor. I also have to warn that for some reason you are presented with messy JavaScript errors when you try to highlight the text background or change the color of the text.
<script language="javascript">
function jsPopupEditor() { var rc = new Array(0,0); rc = window.showModalDialog('http://Server:portno/_layouts/htmledit.aspx?Target=hdnTxt',document.getElementById("hdnTxt"),'dialogHeight:450px;dialogWidth:450px;'); if (rc != null){ document.getElementById("hdnTxt").innerHTML= rc; document.getElementById("hdnTxt").value = rc;} } </script> Here hdnTxt is a hidden multiline textbox containing the HTML to be edited.
Enjai,
-Puneet.H Convert a HEX string to a string in C#This piece of code was originally got from Codeproject.com. This class will decode a HEX string to a string.
/// <summary>
/// Summary description for HexEncoding.
/// </summary>
public class HexEncoding
{
public HexEncoding()
{
//
// TODO: Add constructor logic here
//
}
public static int GetByteCount(string hexString)
{
int numHexChars = 0;
char c;
// remove all none A-F, 0-9, characters
for (int i = 0; i < hexString.Length; i++)
{
c = hexString[i];
if (IsHexDigit(c))
numHexChars++;
}
// if odd number of characters, discard last character
if (numHexChars % 2 != 0)
{
numHexChars--;
}
return numHexChars / 2; // 2 characters per byte
}
/// <summary>
/// Creates a byte array from the hexadecimal string. Each two characters are combined
/// to create one byte. First two hexadecimal characters become first byte in returned array.
/// Non-hexadecimal characters are ignored.
/// </summary>
/// <param name="hexString">string to convert to byte array</param>
/// <param name="discarded">number of characters in string ignored</param>
/// <returns>byte array, in the same left-to-right order as the hexString</returns>
public static byte[] GetBytes(string hexString, out int discarded)
{
discarded = 0;
string newString = "";
char c;
// remove all none A-F, 0-9, characters
for (int i = 0; i < hexString.Length; i++)
{
c = hexString[i];
if (IsHexDigit(c))
newString += c;
else
discarded++;
}
// if odd number of characters, discard last character
if (newString.Length % 2 != 0)
{
discarded++;
newString = newString.Substring(0, newString.Length - 1);
}
int byteLength = newString.Length / 2;
byte[] bytes = new byte[byteLength];
string hex;
int j = 0;
for (int i = 0; i < bytes.Length; i++)
{
hex = new String(new Char[] { newString[j], newString[j + 1] });
bytes[i] = HexToByte(hex);
j = j + 2;
}
return bytes;
}
public static string ToString(byte[] bytes)
{
string hexString = "";
for (int i = 0; i < bytes.Length; i++)
{
hexString += bytes[i].ToString( "X2");
}
return hexString;
}
/// <summary>
/// Determines if given string is in proper hexadecimal string format
/// </summary>
/// <param name="hexString"></param>
/// <returns></returns>
public static bool InHexFormat(string hexString)
{
bool hexFormat = true;
foreach (char digit in hexString)
{
if (!IsHexDigit(digit))
{
hexFormat = false;
break;
}
}
return hexFormat;
}
/// <summary>
/// Returns true is c is a hexadecimal digit (A-F, a-f, 0-9)
/// </summary>
/// <param name="c">Character to test</param>
/// <returns>true if hex digit, false if not</returns>
public static bool IsHexDigit(Char c)
{
int numChar;
int numA = Convert.ToInt32('A');
int num1 = Convert.ToInt32('0');
c = Char.ToUpper(c);
numChar = Convert.ToInt32(c);
if (numChar >= numA && numChar < (numA + 6))
return true;
if (numChar >= num1 && numChar < (num1 + 10))
return true;
return false;
}
/// <summary>
/// Converts 1 or 2 character string into equivalant byte value
/// </summary>
/// <param name="hex">1 or 2 character string</param>
/// <returns>byte</returns>
private static byte HexToByte(string hex)
{
if (hex.Length > 2 || hex.Length <= 0)
throw new ArgumentException("hex must be 1 or 2 characters in length");
byte newByte = byte.Parse(hex, System.Globalization.NumberStyles.HexNumber);
return newByte;
}
}
Enjai,
Puneet.H
SharePoint + Open documents(links) in a new windowWell to force open the documents(links) in a new window. Get the webpart from here and add it to the document libary page.
Enjai
-P.H |
|
|