How do I set Item Level permission on an Issue List in Sharepoint 2007 - sharepoint-2007

I have a Sharepoint Issue List in which I need users to
Read All Items
But Edit Items created by them.
In Sharepoint normal List, We can do so by Advanced Settings -> Item Level Permission. This option is not available in Issue List.
I have even tried with the below Code:
SPList list = web.Lists["Shared Documents"];
list.ReadSecurity = 2;
list.WriteSecurity = 2;
list.Update();
Can anyone suggest what else can be done?

Related

How do I get list of sharepoint items in a folder using Microsoft Graph?

I'm able to make graph calls to get all items in a list but how can we get/filter items inside a list folder ?
It seems not a direct way to achieve it. If I filter using below, I get the error "Field 'FileDirRef' cannot be referenced in filter or orderby as it is not indexed.".
&filter=fields/FileDirRef eq '/sites/lz/Lists/cl/folder'
As a workaround, we can get the list items and then filter the items base on the FileDirRef field in code.
https://graph.microsoft.com/v1.0/sites/lz.sharepoint.com,{Site GUID},{Web GUID}/lists/{List GUID}/items?expand=fields(select=id,Title,FileDirRef)
You could utilize the following query to retrieve items under a sub folder:
https://graph.microsoft.com/v1.0/sites/{site-id}/lists/{list-id}/drive/root:/{folder-url}:/children
Here is an example using Microsoft Graph .NET Client Library:
var folderUrl = "/Archive/2018"; //relative path
var site = graphClient.Sites[siteId];
var list = site.Lists[listId];
var items = await list.Drive.Root.ItemWithPath(folderUrl).Children.Request().Expand("ListItem").GetAsync();
//print list item details
foreach (var item in items)
{
Console.WriteLine(item.ListItem.WebUrl);
}

Update task item programatically in Sharepoint with CSOM

I want to update a task item programatically in CSOM. Item is updating but workflow is not triggering. I need just to open the item in sharepoint and save it. Then workflow is triggering.
List requestTasksList = MyWeb.Lists.GetByTitle("TestRequest Tasks");
List<TestRequestModel> testRequestList = new List<TestRequestModel>();
ListItemCollection ColListItems = requestTasksList.GetItems(Spqur);
ctx.Load(ColListItems);
ctx.ExecuteQuery();
foreach (ListItem task in ColListItems)
{
task["Status"] = "Completed";
task["TaskOutcome"] = "Approved";
task["PercentComplete"] = 1.0;
task["Checkmark"] = 1;
task.Update();
requestTasksList.Update();
}
ctx.ExecuteQuery();
This is the updated task item
As i said, When i click to save button, workflow is triggering and new task is creating.
I'm not sure if its typo but it should be
List requestTasksList = MyWeb.Lists.GetByTitle("TestRequest Tasks");
List<TestRequestModel> testRequestList = new List<TestRequestModel>();
ListItemCollection ColListItems = requestTasksList.GetItems(Spqur);
foreach (ListItem task in ColListItems)
{
task["Status"] = "Completed";
task["TaskOutcome"] = "Approved";
task["PercentComplete"] = 1.0;
task["Checkmark"] = 1;
task.Update();
}
ctx.ExecuteQuery();
We needed to do the same thing and have found that there are no event handlers on the workflow tasks list in SharePoint 2013. I know that there is a SPWorkflowAutostartEventReceiver on lists that have workflows auto start on add or update, so I assumed this same approach would be done for workflow tasks as well, but it is not. Since there are no event handlers on the workflow tasks list, I surmise that all workflow triggers are initiated from the server-side UI code on the task list (horrible design).
For us we need to work completely client side with no farm solution or sandboxed code. So our only solution has been to screen scrape URLs and then open pages or dialogs for the user to do things like cancel all tasks for an approval workflow. Granted, this approach still does requires user input. I suppose you could screen scrape the whole page and play back the action of hitting buttons on a task page or cancel task page if you needed to avoid user input. That would be a pain, though.

Access the Kanban Column (a Team-Specific Field) for a Work Item

Is there a way to programmatically access the "Kanban Column" for a WorkItem using the TFS 2012 API?
Using the Scrum 2.2 template, the history of a Bug or Product Backlog Item shows "[MyProject\MyTeam] Kanban Column" as a changed field whenever a work item is dragged between Kanban columns on the Board, but the field is not accessible when specifically retrieving a work item through the TFS API.
It also shows up as a changed field in the WorkItemChangedEvent object when implementing the ProcessEvent method on the Microsoft.TeamFoundation.Framework.Server.ISubscriber interface.
Workaround:
A coworker found a blogpost about creating a read-only custom field to persist the value of the Kanban Column, taking advantage of the WorkItemChangedEvent to capture the latest value. It is then possible to query on this column. One problem with this approach is that only a single team's Kanban Column can be tracked.
Update:
According to this blogpost, the Kanban Column is not a field, rather a "WIT Extension". This may help lead to an answer.
I've found a way to read the value using the TFS 2013 API, inside the ISubscriber.ProcessEvent method:
var workItemId = 12345;
var extService = new WorkItemTypeExtensionService();
var workItemService = new WorkItemService();
var wit = workItemService.GetWorkItem(requestContext, workItemId);
foreach (var wef in extService.GetExtensions(requestContext, wit.WorkItemTypeExtensionIds))
{
foreach (var field in wef.Fields)
{
if (field.LocalName == "Kanban Column" || field.LocalName == "Backlog items Column")
{
// Access the new column name
var columnName = wit.LatestData[field.Field.FieldId];
}
}
}
If you are prepared to dig into the database you can mine this information out. I don't fully understand the modelling of the teams in TFS yet but first you need to work out which field id the team of interest is storing the Kanban state in as follows (TFS 2012):
USE Tfs_DefaultCollection
SELECT TOP(10)
MarkerField + 1 as FieldId,*
FROM tbl_WorkItemTypeExtensions with(nolock)
JOIN tbl_projects on tbl_WorkItemTypeExtensions.ProjectId = tbl_projects.project_id
WHERE tbl_projects.project_name LIKE '%ProjectName%
Then replace XXXXXXXX below with the FieldId discovered above
SELECT TOP 1000
wid.Id,
wia.State,
wid.StringValue as Kanban,
wia.[Work Item Type],
wia.Title,
tn.Name as Iteration
FROM tbl_WorkItemData wid with(nolock)
JOIN WorkItemsAre wia on wia.ID = wid.Id
JOIN TreeNodes tn on wia.IterationID = tn.ID
WHERE FieldId = XXXXXXXX and RevisedDate = '9999-01-01 00:00:00.000'
ORDER BY Id
I am not familiar with the Scrum 2.2 template, but the works are the same for CMMI or Scrum templates when it comes to TFS Work Item tracking.
Try something like this:
public string GetKanbanColumn(WorkItem wi)
{
if (wi != null)
{
return wi["Kanban"].ToString();
}
return string.Empty;
}
Depending on the actual name of the column, specified in the Work Item Template XML file. Hope this helps.

Tab Groups - Any API

Is there any way to use the high-level APIs to detect whether a tab is in the active Panorama group? It seems there's no mention of the tab group a tab belongs to in the tabs module, at least.
Currently there are no plans to provide a tab group api - the 'panorama' feature in Firefox has not proved to be very popular, so there may not be much benefit vs focusing on other features.
Actually there is a way.
I don't know how to get the XUL tab with the SDK, but I know it's possible as I recall people posting questions that did this. Maybe #canuckistani you can help us get the xul tab.
Anyways once you have the tab then you can access it's property _tabViewTabItem. And from here you can do whatever you want. Like figure out the group id of the tab by going tab._tabViewTabItem.parent.id Or change group id's.
Here is some code, the first two lines are non-sdk code.
var tab = gBrowser.tabContainer.childNodes[10]; //non sdk code
gBrowser.selectedTab = tab; //non sdk code
console.log(tab._tabViewTabItem.parent.id) //works both in sdk and non-sdk
Note: pinned tabs dont have the _tabViewTabItem property. So thats how you can tell if its pinned.
var tabs = gBrowser.tabContainer.childNodes;
for (var i=0; i<tabs.length; i++) {
try {
console.log(tabs[i]._tabViewTabItem.parent.id);
} catch(ex) {
console.warn('tab ' + i + ' ex:', ex);
console.log('its probably pinned')
}
}
The Tab Groups extension stores it's data using SessionStore.
var tabData = JSON.parse(SessionStore.getTabValue(tab,"tabview-tab"));
console.log(tabData.groupID); // 3
Data about the groups themselves is stored on the browser.xul object (ie. ownerGlobal). Data specific to each group is stored as "tabview-group" and other data is stored as "tabview-groups".
var groupsData = JSON.parse(SessionStore.getWindowValue(tab.ownerGlobal, 'tabview-groups'));
console.log(groupsData); // Object { nextID: 4,
activeGroupId: 3,
activeGroupName: "Third Group",
totalNumber: 2 }
var groupData = JSON.parse(SessionStore.getWindowValue(tab.ownerGlobal, 'tabview-group'));
console.log(tabData[3].title); // Third Group

SPListItem.Update and SPFile.Update fail

We are running one MOSS application as below:-
1. user use InfoPath request form to trigger workflow attached to SharePoint document library
2. all sub-sequent tasks are performed by users by InfoPath task form within SharePoint site through "Workflow Task" list (open, checkout, approve or reject) till the task completed.
3. all request form submitted could be viewed as xml file in the document library through "Explorer View"
My quesiton is why I cannot update the item located in the document library, basically open the SPListItem:-
SPSite thisSite = new SPSite("http://server")
{
SPWeb thisWeb = thisSite.OpenWeb("/web")
{
thisSite.AllowUnsafeUpdates = true;
thisWeb.AllowUnsafeUpdates = true;
SPDocumentLibrary library = (SPDocumentLibrary)thisWeb.Lists["DocLib"];
foreach (SPListItem item in library.Items)
{
SPFile file = item.File;
I tried almost all ways I could find:-
item["Customer Name"] = "123456";
item.Update();
// or item.SystemUpdate();
file.Item["Customer Name"] = "123456";
file.Update();
After each update, the value resumed when reopen or visit through the same code lines!
but when I view item properties, the "Last modified" is changed
Last modified at 6/8/2010 12:27 AM by Administrator
This do drive me cray, any help, please.
Thanks & best regards,
Leon
When you publish your form to a list, it asks you to choose the fields to be shown on that list. As you choose the item you want to update, click "Modify". Check the checkbox
at the bottom saying "Allow user to edit data in this field by using a datasheet or property page". This works for me.

Resources