tag:blogger.com,1999:blog-8705297068966115777.post2577247319432294642..comments2023-07-03T13:51:23.493+05:30Comments on SharePoint Kings: HttpContext in eventhandlerParth Patelhttp://www.blogger.com/profile/05132175585607358084noreply@blogger.comBlogger18125tag:blogger.com,1999:blog-8705297068966115777.post-59198768080795602322013-01-25T18:24:12.386+05:302013-01-25T18:24:12.386+05:30thanks a lot :)thanks a lot :)santhoshnoreply@blogger.comtag:blogger.com,1999:blog-8705297068966115777.post-71444721333776831012010-10-11T12:19:38.514+05:302010-10-11T12:19:38.514+05:30@Parastoo,
please check this link
http://www.shar...@Parastoo,<br /><br />please check this link<br /><a href="http://www.sharepointkings.com/2008/09/how-to-start-workflow-programmatically.html" rel="nofollow">http://www.sharepointkings.com/2008/09/how-to-start-workflow-programmatically.html</a><br /><br />also check other workflow related article which will help you.SharePoint Kingshttps://www.blogger.com/profile/08472838332009399790noreply@blogger.comtag:blogger.com,1999:blog-8705297068966115777.post-90151268445825861232010-10-10T10:24:48.527+05:302010-10-10T10:24:48.527+05:30Hi,
1-how can i start workflow with my data withi...Hi,<br /><br />1-how can i start workflow with my data within event handler?(i must send username persone that he/she active eventhandler to workflow,how i do this?)<br /><br />please give me information about manager.startworkflow.(i dont know that datas will pass in manager.startworkflow how is create)<br /><br />2-how i recieve this data in workflow?(or how i call this data of the event handler in workflow)<br />Please Help Me <br /><br />thanksAnonymoushttps://www.blogger.com/profile/15047314985740344677noreply@blogger.comtag:blogger.com,1999:blog-8705297068966115777.post-30861741458506852232010-08-27T21:31:46.759+05:302010-08-27T21:31:46.759+05:30Suresh,
in item adding or deleting event find use...Suresh, <br />in item adding or deleting event find user's groups and do the things no need to redirect for this use error message property with show error trueSharePoint Kingshttps://www.blogger.com/profile/08472838332009399790noreply@blogger.comtag:blogger.com,1999:blog-8705297068966115777.post-74518915129046544072010-08-27T13:34:38.284+05:302010-08-27T13:34:38.284+05:30Hi,
i developed a doucment Library system. there ...Hi, <br />i developed a doucment Library system. there i created some groups like Contrubute Users group without delete, Readonly users group,Admin group.<br />he is my question: how to check login user group to validate Itemdeleteing and itemadding events. based on that i will send a message to other user groups.Sureshhttp://suresh.mynampati@gvkbio.comnoreply@blogger.comtag:blogger.com,1999:blog-8705297068966115777.post-87681242623656845142010-03-04T22:47:20.817+05:302010-03-04T22:47:20.817+05:30Pradeep,
we had not done anything like that but w...Pradeep,<br /><br />we had not done anything like that but what the problem you are facing? you can use event handler and push same question in other site's discussion. (changing the language is your call)<br /><br />are our understanding correct?SharePoint Kingshttps://www.blogger.com/profile/08472838332009399790noreply@blogger.comtag:blogger.com,1999:blog-8705297068966115777.post-63993436928586556142010-03-04T13:14:35.545+05:302010-03-04T13:14:35.545+05:30I have a similar requirement as that of Anil's...I have a similar requirement as that of Anil's requirement.<br /><br />I have a Survey List in English site and a similar list is on the Japanese and Russion Language sites. <br /><br />The requirement is to push the questions created in Survey list on English site to the other two survey lists on Japanese and Russian sites. <br /><br />Let me know if you have dealt with a similar requirement earlier.<br /><br />Thanks<br /><br />Pradeep NarsimhulaPNhttps://www.blogger.com/profile/04988589866167432997noreply@blogger.comtag:blogger.com,1999:blog-8705297068966115777.post-6082886699486086942009-12-28T22:22:25.447+05:302009-12-28T22:22:25.447+05:30Mohammed,
HTTPContext.Current will not be availab...Mohammed,<br /><br />HTTPContext.Current will not be available in ItemAdded directly. because its asynchronous event.<br /><br />you will get HttpContext in only in ItemAdding only <br /><br />can you try cookie if you are using your custom webpart?<br /><br />and lastly check comments by "Manoj Kumar Sriram" in this post<br /><a href="http://www.sharepointkings.com/2008/06/redirection-from-event-handler.html" rel="nofollow">http://www.sharepointkings.com/2008/06/redirection-from-event-handler.html</a><br /><br />he successfully used HttpContext.Current in ItemAdded using static context but you check how its behaving in your caseSharePoint Kingshttps://www.blogger.com/profile/08472838332009399790noreply@blogger.comtag:blogger.com,1999:blog-8705297068966115777.post-75206144519502417442009-12-27T15:39:41.034+05:302009-12-27T15:39:41.034+05:30The HttpContext.Current Is Always Null When upload...The HttpContext.Current Is Always Null When uploading multiple docs at the same time .<br /><br />I faced the same issue when I was tring to update some custom fields of my document library when uploading new documents, the field was ( ProjectID ) which I put it inside a session in my webpart ( the step before uploading the document).<br /><br />What I did is : I put the projectID into the cache ( per user ) inside the custom webpart which acts as a session as follows :<br /><br />if (Request.QueryString["ProjectID"] != null)<br />{<br /> HttpRuntime.Cache.Remove(SPContext.Current.Web.CurrentUser.LoginName);<br /> HttpRuntime.Cache.Add(SPContext.Current.Web.CurrentUser.LoginName, ProjectID, null, DateTime.UtcNow.AddMinutes(60), System.Web.Caching.Cache.NoSlidingExpiration, System.Web.Caching.CacheItemPriority.Normal, null);<br />}<br /><br />then I implemented the ItemAdded event and I get the value of the cached projectId through :<br /><br /><br /><br /> public override void ItemAdded(SPItemEventProperties properties)<br /> {<br /> try<br /> {<br /><br /> string ProjID = "";<br /><br /> string CreatedBy = null;<br /> if (properties.ListItem["Created By"] != null)<br /> CreatedBy = properties.ListItem["Created By"].ToString().Split(';')[1].Replace("#","");<br /><br /> if (HttpRuntime.Cache[CreatedBy] != null)<br /> { <br /> //SPContext.Current.Web.CurrentUser.LoginName;<br /> ProjID = HttpRuntime.Cache[CreatedBy].ToString();<br /><br /> if (properties.ListItem["Project"] == null)<br /> {<br /> properties.ListItem["Project"] = new SPFieldLookupValue(ProjID);<br /> properties.ListItem.SystemUpdate();<br /> }<br /><br /><br /> base.ItemAdded(properties);<br /><br /> }<br /><br /> }<br /> catch (Exception ex)<br /> { }<br /><br /> <br /> }Mohammed Barakathttps://www.blogger.com/profile/04445737487942445508noreply@blogger.comtag:blogger.com,1999:blog-8705297068966115777.post-25803098906661919982009-05-11T05:12:00.000+05:302009-05-11T05:12:00.000+05:30Cool: re null httpcontext
you have to declare an...Cool: re null httpcontext<br /><br /> you have to declare and set the value of your httpcontext variable in the top level of your eventhandler. Right after the namespace and before your eventhandler class. Else it is null but does compile below that level.<br />rayMondohttps://www.blogger.com/profile/07262588050351964367noreply@blogger.comtag:blogger.com,1999:blog-8705297068966115777.post-23023980230122453372009-01-12T10:51:00.000+05:302009-01-12T10:51:00.000+05:30Hai Chris,I had an SPList in my main site and anot...Hai Chris,<BR/><BR/>I had an SPList in my main site and another one SPList in my subsite. These two SPList has same fields. In my main site i have a temporary SPList, when i add any item in the main site SPList or subsite SPList i need to trigger my event handler and which add corresponding item to my temporary SPList also (which is in main site)<BR/><BR/>Note: I have a subsite, in it i have an SPList, when i add an new item to the subsite SPList also i need to trigger my event handler.<BR/><BR/>Can you tell me how can i do it,<BR/><BR/>Thanx in advance.<BR/><BR/>AnilChitatil<BR/>anilchitatil@gmail.comAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-8705297068966115777.post-66971447197095713272008-11-06T22:34:00.000+05:302008-11-06T22:34:00.000+05:30Hi,I have a scenario where I need to get the HttpC...Hi,<BR/><BR/>I have a scenario where I need to get the HttpContext on the OnActivated() method which is part of the Custom Site Definition provisioning. I'm trying to do a redirect using the SPUtility.Redirect to a custom application page which will set the permissions similar to permsetup.aspx. Always I get the HttpContext as null when the code hits SPUtility.Redirect.<BR/><BR/>SPUtility.Redirect("new_permsetup.aspx", SPRedirectFlags.RelativeToLayoutsPage,HttpContext.Current);<BR/><BR/>The above redirect is used on the siteprovisioning.cs page which basically has a partial class inheriting from <B>SPFeatureReceiver</B> and hence I'm not able to get the context as you mentioned in your earlier posts using <B>SPItemEventReceiver</B>. Any thoughts will be much appreciated.Unknownhttps://www.blogger.com/profile/06643960787187619444noreply@blogger.comtag:blogger.com,1999:blog-8705297068966115777.post-68005333989502273792008-11-06T19:53:00.000+05:302008-11-06T19:53:00.000+05:30Hi,I have a scenario where I need to get the HttpC...Hi,<BR/><BR/>I have a scenario where I need to get the HttpContext on the OnActivated() method which is part of the Custom Site Definition provisioning. I'm trying to do a redirect using the SPUtility.Redirect to a custom application page which will set the permissions similar to permsetup.aspx. Always I get the HttpContext as null when the code hits SPUtility.Redirect.<BR/><BR/>SPUtility.Redirect("new_permsetup.aspx", SPRedirectFlags.RelativeToLayoutsPage,HttpContext.Current);<BR/><BR/>The above redirect is used on the siteprovisioning.cs page which basically has a partial class inheriting from <B>SPFeatureReceiver</B> and hence I'm not able to get the context as you mentioned in your earlier posts using <B>SPItemEventReceiver</B>. Any thoughts will be much appreciated.<BR/><BR/>VJUnknownhttps://www.blogger.com/profile/06643960787187619444noreply@blogger.comtag:blogger.com,1999:blog-8705297068966115777.post-51031049565018878302008-08-11T14:31:00.000+05:302008-08-11T14:31:00.000+05:30Thanks lot for your help....It worked!Thanks lot for your help....<BR/>It worked!Csam0003https://www.blogger.com/profile/06035103510725767563noreply@blogger.comtag:blogger.com,1999:blog-8705297068966115777.post-72539132482706391562008-08-01T11:01:00.000+05:302008-08-01T11:01:00.000+05:30Hi chris,This code works for you,and kindly metion...Hi chris,<BR/>This code works for you,and kindly metion your mail id so that we can provide you better service.<BR/><BR/>public override void ItemAdded(SPItemEventProperties properties)<BR/> {<BR/> base.ItemAdded(properties);<BR/> this.DisableEventFiring();<BR/> using (SPSite site = new SPSite(properties.SiteId))<BR/> {<BR/> SPWeb subsite = site.OpenWeb();<BR/> SPWebCollection subSites = subsite.Webs;<BR/> SPWeb newSubWeb = subSites.Add("SPKINGS");<BR/> newSubWeb.Update();<BR/> }<BR/> this.EnableEventFiring();<BR/> }<BR/><BR/>Regards,<BR/>SharePointKings Team.Jayesh Prajapatihttps://www.blogger.com/profile/09680745430286107858noreply@blogger.comtag:blogger.com,1999:blog-8705297068966115777.post-3233356699052751212008-07-31T17:04:00.000+05:302008-07-31T17:04:00.000+05:30Hi,I am writting an event handler for a list and h...Hi,<BR/><BR/>I am writting an event handler for a list and here is my code: <BR/>SPSite newSite = new SPSite(SPContext.Current.Site.url);<BR/><BR/>SPWeb newWeb = newSite.OpenWeb();<BR/><BR/>SPWebCollection subSites = newWeb.Webs;<BR/><BR/>SPWeb newSubWeb = subSites.Add(SiteTitle,SiteTitle,Description....)<BR/><BR/>The above code for some reason is not working. However when I harcode the url rather than trying to get the current url using SPContext it works!!!<BR/><BR/>Can you please tell me what I might eb doing wrong!<BR/><BR/>Thanks alot<BR/><BR/>Chris SammutCsam0003https://www.blogger.com/profile/06035103510725767563noreply@blogger.comtag:blogger.com,1999:blog-8705297068966115777.post-2204519873117429812008-07-24T10:55:00.000+05:302008-07-24T10:55:00.000+05:30You are absolutely right.We had taken idea from th...You are absolutely right.<BR/>We had taken idea from that site only and we have already given a link (More info) at the bottom of the post.<BR/><BR/>That was our mistake that we had not mentioned name of "Mr. Adil Baig" in the post, that we edited now.<BR/>Check the post again.<BR/>Thanks.Parth Patelhttps://www.blogger.com/profile/05132175585607358084noreply@blogger.comtag:blogger.com,1999:blog-8705297068966115777.post-66582998339068628952008-07-24T09:47:00.000+05:302008-07-24T09:47:00.000+05:30this sounds familiar from an older post by this gu...this sounds familiar from an older post by this guy, does it???<BR/>http://baigadil.blogspot.com/2008/01/getting-application-context-in.htmlAnonymousnoreply@blogger.com