Welcome

Sharepoint lead is a place where you can read about interesting topics related to sharepoint, and you can also post comments and suggessions.
Showing posts with label sharepoint. Show all posts
Showing posts with label sharepoint. Show all posts

Thursday, November 27, 2014

iCal - Cancel 1 meeting from recurring meetings

I was working on generating an iCAL invite from a calendar item and was having difficulty deleting once of the event from series.

I found that you have to generate the same ICAL invite that you did for recurring event but there will be two things different
  1. Add Recurrence-ID;Value:DATE=yyyyMMDD (your get the value from SPListItem["ReucurrenceID"])
  2. Change the METHOD in your email and ical content to CANCEL
  3. Increment sequence parameter
Once you adjust your cancel invite with these three changes, your email will show remove from calendar link and clicking on it will only remove the event specified in Recurrence-ID.

Sunday, January 6, 2013

System.ArgumentException: Exception of type 'System.ArgumentException' was thrown. Parameter name: encodedValue

I was configuring one of our clients farm which required FBA on different web applications (around 5) and he wanted each web application should have separate user store. That was too tricky since you just need to set up Application property of the membership provider and you are done.
After completion of these settings, all of my applications were having a common exception either in log out or login to the web application. Here was the exception.
System.ArgumentException: Exception of type 'System.ArgumentException' was thrown.  Parameter name: encodedValue    at Microsoft.SharePoint.Administration.Claims.SPClaimEncodingManager.DecodeClaimFromFormsSuffix(String encodedValue)     at Microsoft.SharePoint.Administration.Claims.SPClaimProviderManager.GetProviderUserKey(IClaimsIdentity claimsIdentity, String encodedIdentityClaimSuffix)     at Microsoft.SharePoint.Administration.Claims.SPClaimProviderManager.GetProviderUserKey(String encodedIdentityClaimSuffix)     at Microsoft.SharePoint.Utilities.SPUtility.GetFullUserKeyFromLoginName(String loginName)     at Microsoft.SharePoint.ApplicationRuntime.SPHeaderManager.AddIsapiHeaders(HttpContext context, String encodedUrl, NameValueCollection headers)     at Microsoft.SharePoint.ApplicationRuntime.SPRequestModule.PreRequestExecuteAppHandler(Object oSender, EventArgs ea)     at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()     at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
After checking all my steps right through starting. After getting all the other exeptions cleared the above exception was the only exception that I was getting. That was resolved using "Exception of type 'System.ArgumentException' was thrown" got error when i have signout from webapplication in sharepoint 2010?.
I hope this will help to you if you are getting same error due to a silly custom property of a custom web part for registration!

Update - 5/19/2014

There are several solutions that I tried:
The same error also encountered again reported by client when he tries to enable intranet through internet explorer settings. Disabling detection of intranet from internet options solves that issue but you are forced to enter username password every first visit of the site even in intranet as well!

Update - 5/25/2014

This is a SharePoint bug also found some discussion here: https://sharepoint2013fba.codeplex.com/workitem/9 

Hope this helps

Sunday, December 30, 2012

SharePoint 2010 foundation on windows 7

If you are planning to install SharePoint 2010 foundation in your windows 7 machine, there are very good references out there in many blogs. But after I installed it I was not able to create new web applications.

I noticed, I was an administrator account with different name than administrator. I found here that we can enable in built administrator account.

I enabled administrator account and added it to managed accounts and farm administrators group.

After trying so many things from forums, finally I got everything working in SharePoint Foundation in my machine!

Friday, December 28, 2012

SharePoint 2013 FBA Pack

I tried to install SharePoint 2010 FBA Pack in SharePoint 2013 and it was working almost OK. I started facing some minor issues and I fixed them one by one.

Entire solution with my fixes is available as a BitBucket repository here

Following are list of issues and how I fixed them.

  1. When you go to add new user from user manager, and click on cancel, it was showing error
    Solution:
    Replaced code
    string url = "FBA/Management/UsersDisp.aspx";
                SPUtility.DetermineRedirectUrl(url,SPRedirectFlags.RelativeToLayoutsPage, this.Context,null, out url);
    with
    string url = "/_layouts/FBA/Management/UsersDisp.aspx";
                //SPUtility.DetermineRedirectUrl(url,SPRedirectFlags.RelativeToLayoutsPage, this.Context,null, out url);
    So, in nutshell, when you are using the previous code, it redirects to /_layouts/15/FBA/UserDisp.aspx and our actual path is in 14 folder.
  2. Similar redirection problems where there when you click edit user and click on cancel, click on reset password and click on cancel etc. I fixed them all by replacing SPUtility.Redirect to Response.Redirect
  3. Use of upgraded user controls.
    When you go to any page, for example UserNew.aspx, you will notice that there are controls used in the page that are registered from "_controltemplates/xxxx.ascx", I upgraded them to use "_controltemplates/15/xxxx.ascx.
    You must be wondering how did I come to know about this? I looked at the page in 15 hive's admin folder and some random aspx page over there, I noticed the new path.
  4. Last one was, Due to SharePoint 2013 titles, breadcrumbs where causing long scroll. I updated resource file to update titles. I just updated titles and used "Manage Users", "Add Users" in place of using all long titles that are used out of the box.
  5. When I tried to package the solution after changes are done, It was giving me too long path error, so I renamed project name and package name to FBA. You will still able to install/upgrade it using stsadmin command.
This are really simple and small fixes, and only contains minor changes that make you able to work. If you have any other bugs, just post it to the public BitBucket repository that I have created and I will try to help you.

In next couple of posts we will discuss about adding customer properties through profile provider. If you have any other sugessions or feedback, I will be more than happy to hear back.

Monday, July 2, 2012

Sharepoint 2010: TryGetList vs GetList

As a developer, you will say GetList can throw exception but TryGetList will not. It is actually confusing because TryGetList looks for listTitle and returns null if list is not available at expected location. GetList will expect listUrl and can throw FileNotFoundException or ArgumentException if list is not present at expected location or relative/absolute url of list is invalid relatively. Another biggest difference is they belong to different class!


Apart from all those technical details, I noticed that many sharepoint administrators likes to start with a simple list/library name and eventually change it to make it as close as possible to what they do. That will make list/library url and their names different. Here comes the actual problem. If you are actually using list/library names in your code, it will no longer work. OR we can say you are not allowing sharepoint administrators to change name of list/library that they have created. 


By using GetList you are actually giving them flexibility to use whatever name they like to use, as far as they are not changing url or list/library code will still work.


In conclusion, it really depends on requirements how you are going to deal with the situation but it is good to keep in mind that you can use GetUrl function in your code to allow sharepoint administrators to change their names without worrying about breaking functionality.







Friday, June 22, 2012

How to use soapUI to review ListData.svc


Introduction

​SoapUI is a free tool that can be used to test out of the box ListData.svc service provided by sharepoint. This service is available at /_vti_bin/ListData.svc for any of your sharepoint site. Here is how we can try it out using SoapUI.

Step 1: Install sopa UI and click on File > New SoapUI Project. Add some project name and check "Add REST Seervice:" like shown in following figure and then click OK



Step 2: After clicking on OK another window will open like following, just click on OK




Step3: New REST resource window will appear. In resource name enter site url and in resource path/endpoint provide list/document library name and click on "Extract params" button. Following is the screen that shows sample data.




Step4:That will automatically create a new request called Request 1.This request will automaticlaly detect endpoint and path to your list/document library. If it is not, just click on"-no endpoint set-" and click on add new endpoint. Enter site url in the dialog again.



Step5: Maximize "Request 1" window in soapUI. In botton left corner you will see " ... ", click on it and you will be able to provide sharepoint authentication details there.



Step6: Once you are done with authentication details you can click on execute icon at top left corner of "request 1" window (marked in above figure) to execute the request and you will be able to see response at right hand side window.

Step7: ListData.svc can also return json data in response out of the box. Just try to provide accept = application/json like shown in figure below:


Conclution:
SoapUI is a super simple too to try out and it will be really help to review xml/json data while you are planninig to consume it with jQuery. 


Wednesday, May 16, 2012

jQuery.find not working in IE7 for xml data


As part of troubleshooting a shareoint functionality, we found that jQuery.find not working.
We were using jQuery.ajax to call a sharepoint web service and in success function, finding an element in response xml to render it on div.
We fixed this and there are couple of options to fix this that we found from stackoverflow.
1. add dataType: 'xml​' in jQuery.ajax and that will fix it.
2. in response, check for browser is IE7 and variable that is having data is blank, do it with another method, here is javascript code:
if ($.browser.msie && liHtml == "") {
    xml = new ActiveXObject("Microsoft.XMLDOM");
    xml.async = false;
    xml.loadXML(response);
    liHtml = $("XmlTagNameToFind",xml).text();
}
I hope this will he you as well.

Monday, May 14, 2012

using HttpContext.GetGlobalResourceObject in webpart development


I found interesting issue during working with global resource files this week.

Problem:
Event if we are using HttpContext.GetGlobalResourceObject, web part was rendering data in English even if site language is other than English!

If we switch to edit mode, it was working sometime, but most of the time it was showing English text.

Root cause:
We tried creating a new application page and placed a webpart there, it was strange that it was working properly in the application page.

We finally found that at the time of reading resources through  HttpContext.GetGlobalResourceObject web part was not aware of the current UICulture

Solution:
Before:
   1:  var strLinkText = HttpContext.GetGlobalResourceObject("file", "key");
After:​
   1:  var strLinkText = HttpContext.GetGlobalResourceObject("file", "key",SPContext.Current.Web.UICulture);

Conclusion
Finally after passing third argument from SPContext.Current.Web.UICulture it worked properly