Adding a Fix version using JIRA SOAP API - c#

I am trying to use the JIRA SOAP API to add a fix version to an issue. I know that similar questions have been asked before, but I still cannot get it to work. Here is the link to the most relevant question, in case someone can make better use of the information there than I can:
jirasoapservice and Fix Version
I feel like I am doing everyting correct but the fix version is never added. As the answer to the above question says, I do not set an ID and I have made sure that the name is correct by looking at the project's getVersions array.
I am using C#. Thanks for any advice. A working code snippet in C# would be very helpful.

I turns out that you can update this field as you would any other field:
RemoteFieldValue v = new RemoteFieldValue
{
id = "fixVersions",
values = new String[] { wi.Fields[29].Value.ToString() }
};
List<RemoteFieldValue> actionParams = new List<RemoteFieldValue>();
actionParams.Add(v);
jiraSoapServiceService.updateIssue(token, key, actionParams.ToArray());

Related

Azure Notification Hub installation not updating tags

I am attempting to update the tags of an installation within Azure Notification Hub after registration. I am following several guides for this, notably here and here.
Both of these guides suggest that the following code should work however it is plainly not; the tag never gets updated. There are no errors, and I can guarantee that the installationId is correct. I am guessing I am setting the path/value of the tag incorrectly.
// in constructor:
var _notificationHub = NotificationHubClient.CreateClientFromConnectionString(Settings.ConnectionStrings.NotificationHub, Settings.Defaults.NotificationHubName);
// in WebApi endpoint:
var installationUpdates = new List<PartialUpdateOperation>();
var userDetail = _userDetailRepo.Get(id);
installationUpdates.Add(new PartialUpdateOperation
{
Operation = UpdateOperationType.Replace,
Path = "/tags/interestedin", // is this incorrect?
Value = interestedIn.ToUpper()
});
userDetail.InterestedIn = interestedIn;
await Task.WhenAll(
_userDetailRepo.InsertOrReplace(userDetail),
_notificationHub.PatchInstallationAsync(installationId, installationUpdates));
Here is the installation object's tags, as per VS:
I also tried hardcoding the path to Path = "/tags/interestedin:W" but it made no difference.
Can someone tell me if I am doing something wrong here, and if so how I should amend my code. Thanks.
Unfortunately, Path = "/tags/interestedin" is not going to work as of now. We are currently working on wildcards' support. Once it is done, something like "/tags/interestedin*" will work fine for you.
While Path = "/tags/interestedin:W" should be OK. If you could provide namespace name, hub name, and a timeframe, then I'll take a look at logs to check what is going on there.

Skybrud social Log in via Facebook?

I'm usinng skybrud social to allow users to log into my site via Facebook, but am having a problem.
For some reason, the response never contains anything other than the Name and Id of the user... everything else is null.
var url = client.GetAuthorizationUrl(state, "public_profile", "email");
var service = FacebookService.CreateFromAccessToken(userAccessToken);
FacebookMeResponse user = service.Methods.Me();
Has anyone experienced this before? What could be the problem?
Facebook has multiple versions of their Graph API. In the most recent version (2.4), less fields are returned by default, and you instead have to tell the API to return the fields that you need. What version of the API you're using depends on the time you registered your app with Facebook.
Based on your code, it seems that you're using an older version of Skybrud.Social. If you update to the most recent version (0.9.4.1), you can do something like this:
// Declare the options for the call to the API
FacebookGetUserOptions options = new FacebookGetUserOptions("me") {
Fields = "name,email,gender"
};
// Make the call to the API
FacebookUserResponse response = service.Users.GetUser(options);
Hope this answers your questions ;)

Sitecore LinkManager ExpandDynamicLinks does not resolve the site URL

I am having a problem with the ExpandDynamicLinks in Sitecore.
I am using the following method passing true for siteResolving. The problem is the site is not being resolved as promissed.
bodyExpandedLinks = Sitecore.Links.LinkManager.ExpandDynamicLinks(email.Body.Value, true);
I did set in my provider to never resolve the site because that is what I want for the whole site except for this email body above.
alwaysIncludeServerUrl="false"
Does anybody know how to force that?
Thank you...
I know this post is tagged with sitecore7, but I would like to share a solution for Sitecore 8.1. I don't know if it works for 7 or not. It is adapted from Sitecore.Links.LinkProvider.ExpandDynamicLinks():
var linkParser = new LinkProvider.LinkParser();
var urlOptions = LinkManager.Provider.GetDefaultUrlOptions(); // returns a clone.
urlOptions.SiteResolving = true;
urlOptions.AlwaysIncludeServerUrl = true;
text = linkParser.ExpandDynamicLinks(text, urlOptions);
This does not work for media links because Sitecore.Links.DynamicLink.BuildMediaUrl() and Sitecore.Links.MediaLinkExpander.Expand() completely ignore their UrlOptions parameter. If you need full media urls, wrap your code with this:
using (new SettingsSwitcher("Media.AlwaysIncludeServerUrl", "true"))
{
phrase = linkParser.ExpandDynamicLinks(phrase, urlOptions);
}
one option might be to check if AlwaysIncludeServerUrl is set to False before your call to ExpandDynamicLinks. If it's False you can explicitly call Sitecore.Links.UrlOptions.DefaultOptions.AlwaysIncludeServerUrl = true and then set it back to False after you have called ExpandDynamicLinks.
I found an alternative method.
I did add a extra link provider, with the same configurations but the alwaysIncludeServerUrl which I set to true.
<add name="sitecore_expandlinks" alwaysIncludeServerUrl="true" (...) >
Then I got the provider using the API.
bodyExpandedLinks = Sitecore.Links.LinkManager.Providers["sitecore_expandlinks"].ExpandDynamicLinks(email.Body.Value, true);
If someone else has a more cohesive option I would much appreciate
Thanks.

saving get data to a local variable

I was wondering is there a way to save get parameters that the website sends to the server to be saved to a local variable via java script. something like a cookie or the session variable.
EDIT 1:
I am also willing to save it to a server-side cookie, but i still don't know how to do that.
i am using MVC4 in VisualStudio with C# as server-side lang. if there is an easier method to do it server side I'm up for that.
EDIT 2
The comment game me an idea, and i managed to get the solution via the session class server-side. thanks ppl :)
function getUrlParams() {
var params = {};
window.location.search.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(str,key,value) {
params[key] = value;
});
return params;
}
Using the Session.AddItem method i was able to save all the data i needed. thanks for your help guys.

Modify the content of the home page programmatically in SharePoint 2010

First of all, I'm pretty new to SharePoint so don't shoot me if this is a noobish question or if I don't provide all the right information at once... :)
I have a team-site in SharePoint with following URL: "http://myServer/Opdracht_Ben/". By going to this URL I'm redirected to following page: "http://myServer/sites/Opdracht_Ben/SitePages/Home.aspx".
In Visual Studio I have a project for this site with a feature. When this site-feature is activated it should change the content of the home-page to some custom tekst and layout (i.e.: HTML). The content is not contained within a web part or the page is not a WikiPage, just text on a page.
I've been looking on MSDN and on several tech-sites and blogs but I have not found anything that could help me further. Does anyone know how I can 'reach' the content of the page and modify/update it?
PS:
Here on SO I have found a related question (Click for the question), but the provided solution is for when the web is a "Publishing Web", which is not the case here, so that solution won't do me any good.
Thanks in advance!
I have found out that the page IS a WikiPage after all. So I managed to change the content with following code:
using (var site = new SPSite(ApplicationResources.Url.SiteRoot))
{
using (var web = site.OpenWeb())
{
var page = web.GetFile(ApplicationResources.Url.FullDefaultPageName);
var item = page.Item;
item["Wiki Content"] = NewContent(title, text);
item.Update();
}
}
Maybe this is not the best method, so if anyone has a better and more reliable solution: feel free to correct me! ;)

Categories