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

Sunday, June 15, 2014

Multi domains in SharePoint 2010 people picker

In SharePoint environment people picker is one of the main part in the farm to provide the users available from all the domains to select the users. By configuring stsadm commands we can grab the users from different domains.
SharePoint will use Application pool identity to search users in active directory. If application pool account is not having permissions to do that, we have to encrypt the password.

To do that we can use following command in STSADM,

stsadm -o setapppassword -password  password

We have to set the domains should be searched on WFE for each web application,

stsadm -o setproperty -pn peoplepicker-searchadforests –pv domain:domain1;domain:domain2,domain2\account,password -url WebApplication
 
Hope this helps.



Saturday, June 14, 2014

SPGridView error: Value cannot be null. Parameter name:propName

While working with SharePoint grid view to show data, I got an error saying that “Value cannot be null. Parameter name:prop name as shown the image below.



I have checked the properties assigned to SPGridview. By default SPGrid will have option to group the result based on a column. By setting AllowGrouping is “true” we can group the data. We have to specify the grouping column name, Group collapse and Group field display name as shown the code below.

SPGridView.AllowGrouping=true;
SpGridView. GroupField=”Group Field Name”;
SPGridView.AllowGroupCollapse = false;
SPGridView.GroupDescriptionField = “Group Description Name”;
SPGridView.GroupFieldDisplayName = “DisplayName Text

We have to set GroupField, AllGroupCollapse, GroupDescriptionField and GroupFieldDisplayName along with AllwGrouping field to fix the error.

Wednesday, June 4, 2014

SPGrid Error in SharePoint 2010: System.ArgumentNullException: Value cannot be null. Parameter name: container

While working with SharePoint 2010 Grid view grouping depending on dropdown value, got an error saying that “Value cannot be null. Parameter name: Container” as shown the image below.
















Iam unable to find the issue while debugging the code. I have spent much time on this issue finally got the reason. By making “EnableViewState” to false error got fixed as show the code below.

grdPropertyValues.EnableViewState = false;
grdPropertyValues.AllowSorting = true;
grdPropertyValues.AllowGrouping = true;
grdPropertyValues.AllowGroupCollapse = true;



Here grdPropertyValues is SPGridview object. Hope this helps.

Saturday, May 17, 2014

SharePoint 2010 installation Error – Could not create Configuration database

While installing SharePoint, I got an error saying that “Could not create Configuration database - Failed to call GetTypes on assembly Microsoft.Office.InfoPath.Server, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c The system cannot find the file specified. Could not load file or assembly 'Microsoft.Office.InfoPath, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' or one of its dependencies.

I have rechecked pre-requisites and re-installed all the pre-requisites. But still Iam facing the same issue. By checking the issue in deep I have found that issue is related to InfoPath. In my machine Iam having InfoPath 2013. It’s blocking SharePoint Configuration wizard to create database.

To fix this issue we have to uninstall InfoPath from current machine. After uninstalling the InfoPath Configuration wizard ran successfully.

Hope this helps.

Friday, May 16, 2014

SharePoint – Back to Basics – SharePoint URL field link open in new window using JavaScript

One my project I got a requirement that in SharePoint URL field we have to open the link in new window. But URL field, we don't have option to open the link in new window through UI. For that I have added custom JavaScript in Content editor web part/Script web part.

Before updating JavaScript we have to add #Opennewtab at the end of the URL in URL field as Show the image below.



Add following JavaScript to the List items page through Content Editor web part/ Script editor web part.

<script language="JavaScript">
_spBodyOnLoadFunctionNames.push("UpdateLinks");
function UpdateLinks() {
var anchorsTags = document.getElementsByTagName("a");
for (var x=0; x< anchorsTags.length; x++) {
if (anchors[x].outerHTML.indexOf('#Opennewtab)>0)
{
                oldText = anchors[x].outerHTML;
                newText = oldText.replace(/#Opennewtab/,'" target="_blank');
                anchors[x].outerHTML = newText;
}
}
}
</script>

After adding this script save and close the web part. All the links added with #OpeninNewtab will be open in new window.

Saturday, April 19, 2014

Send meeting request in SharePoint custom workflow

Working with SharePoint workflow I got a requirement to send meeting request by using the code. I have dig into deep to check if there is any option to send meeting requests by using SharePoint workflow but I couldn’t find anything. So we have only option to send meeting request through C# code.
My friend Ravi helped me on the code finally by using the code below we are able to send the meeting requests.

private void SendMeetingRequestMail(VacationRequestMail reqMail, string smtpTO, string smtpServer, string smtpFrom)
        {
            using (MailMessage mailMessage = new MailMessage(smtpFrom, smtpTO))
            {
                mailMessage.Subject = “Subject”;
                mailMessage.Body = “Body”;


                DateTime startDate = “Start Date and Time
                DateTime endDate = “End Date and Time

                StringBuilder str = new StringBuilder();
                str.AppendLine("BEGIN:VCALENDAR");
                str.AppendLine("PRODID:-//Vacation Request Portal");
                str.AppendLine("VERSION:2.0");
                str.AppendLine("METHOD:REQUEST");
                str.AppendLine("BEGIN:VEVENT");
                str.AppendLine(string.Format("DTSTART:{0:yyyyMMddTHHmmssZ}", startDate));
                str.AppendLine(string.Format("DTEND:{0:yyyyMMddTHHmmssZ}", endDate));
                str.AppendLine("LOCATION: Vacation Request Portal, India");
                str.AppendLine(string.Format("X-MICROSOFT-CDO-ALLDAYEVENT:TRUE"));
                str.AppendLine(string.Format("UID:{0}", Guid.NewGuid()));
                str.AppendLine(string.Format("DESCRIPTION:{0}", mailMessage.Body));
                str.AppendLine(string.Format("X-ALT-DESC;FMTTYPE=text/html:{0}", mailMessage.Body));
                str.AppendLine(string.Format("SUMMARY:{0}", mailMessage.Subject));
                str.AppendLine(string.Format("ORGANIZER:MAILTO:{0}", mailMessage.From.Address));
                str.AppendLine("X-MICROSOFT-CDO-BUSYSTATUS:FREE");
                str.AppendLine("BEGIN:VALARM");
                str.AppendLine("TRIGGER:-PT18H");
                str.AppendLine("ACTION:DISPLAY");
                str.AppendLine("DESCRIPTION:Reminder");
                str.AppendLine("END:VALARM");
                str.AppendLine("END:VEVENT");
                str.AppendLine("END:VCALENDAR");
                System.Net.Mime.ContentType ct = new System.Net.Mime.ContentType("text/calendar");
                ct.Parameters.Add("method", "REQUEST");
                AlternateView avCal = AlternateView.CreateAlternateViewFromString(str.ToString(), ct);
                mailMessage.AlternateViews.Add(avCal);

                using (SmtpClient smtpClient = new SmtpClient(smtpServer))
                {
                    smtpClient.Send(mailMessage);
                }
            }
        }

We have multiple options while sending meeting requests. For example “X-MICROSOFT-CDO-BUSYSTATUS:FREE” will set the user state to free even user accept the meeting request. Hope this will help.